Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

How to convert Html to Excel by C # VB.NET

2025-01-17 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >

Share

Shulou(Shulou.com)06/01 Report--

This article mainly introduces the relevant knowledge of "how C # VB.NET turns Html into Excel". The editor shows you the operation process through an actual case. The method of operation is simple, fast and practical. I hope this article "how C # VB.NET converts Html into Excel" can help you solve the problem.

Dll reference method 1

Download Spire.XLS for .NET locally, extract it, and install it. After completing the installation, locate the Spire.Xls.dll under the BIN folder under the installation path. Then open solution Explorer in Visual Studio, right-click "reference" and "add reference" to add a reference to the dll file under the local path BIN folder.

Method 2

Install via NuGet. It can be installed in the following two ways:

1. You can open solution Explorer in Visual Studio, right-click "references", "manage NuGet packages", then search for "Spire.XLS" and click "install". Wait for the program to be installed.

two。 Copy the following to the PM console installation.

Install-Package Spire.XLS-Version 12.3.2

Convert HTML to ExcelC#using Spire.Xls;namespace HtmlToExcel {class Program {static void Main (string [] args) {/ / load sample document Workbook workbook = new Workbook (); workbook.LoadFromHtml ("test.html"); / / Adaptive line height Worksheet sheet = workbook.Worksheets [0]; sheet.AllocatedRange.AutoFitRows () / / Save document workbook.SaveToFile ("HtmlToExcel.xlsx", FileFormat.Version2013) } vb.netImports Spire.XlsNamespace HtmlToExcel Class Program Private Shared Sub Main (args As String ()) 'load sample document Dim workbook As New Workbook () workbook.LoadFromHtml ("monthly accounting .html")' adaptive line height Dim sheet As Worksheet = workbook.Worksheets (0) sheet.AllocatedRange.AutoFitRows () 'Save the document workbook.SaveToFile ("HtmlToExcel.xlsx") FileFormat.Version2013) End Sub End ClassEnd Namespace

Conversion effect:

This is the end of the introduction to "how C # VB.NET converts Html to Excel". Thank you for reading. If you want to know more about the industry, you can follow the industry information channel. The editor will update different knowledge points for you every day.

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Development

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report