This article is a mirror article of machine translation, please click here to jump to the original article.

View: 18368|Reply: 0

[Tips] Aspose+NPOI - Excel import and export

[Copy link]
Posted on 6/29/2019 12:55:51 AM | | |

preface


Excel is often used to import and export data in projects. Generally, we use third-party DLLs for implementation. For example: Aspose and NPOI. The former requires payment, but you can also use the free version, the difference is that there will be a watermark in the exported Excel (it can be solved with the activation code of the cracked version). NPOI is a free version, but it is not as easy to use as Aspose, but it also meets basic needs. This article will document two types of DLL combinations, one for import and one for export.



Text


1: Refer to Aspose and NPOI dlls. Go to NuGet to download it, or you can download it from this site (https://down.itsvse.com/item/13478.html

2: Create a new public method PublicMethod.cs

3: Paste the code inside the common method



4: Direct call method:

Import call: PublicMethod.GetDataFromExcelByCom(true, openFile.FileName);  Aspose used
Export call: PublicMethod.OutToExcelFromDataTable(fileName, dt, true); NPOI used



Epilogue




If you need to use Aspose for export operations, link the AsposeLicense.dll reference in the zip package above, and then add the following code where the program starts: LicenseHelper.ModifyInMemory.ActivateMemoryPatching(); This way, there will be no watermark inside Excel.







Previous:Java encapsulation zip unzip method
Next:Vultr VPS Hosting Panel General Management Graphic Guide covers basic VPS operations
Disclaimer:
All software, programming materials or articles published by Code Farmer Network are only for learning and research purposes; The above content shall not be used for commercial or illegal purposes, otherwise, users shall bear all consequences. The information on this site comes from the Internet, and copyright disputes have nothing to do with this site. You must completely delete the above content from your computer within 24 hours of downloading. If you like the program, please support genuine software, purchase registration, and get better genuine services. If there is any infringement, please contact us by email.

Mail To:help@itsvse.com