In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-01-15 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Network Security >
Share
Shulou(Shulou.com)06/01 Report--
Use the Spire component to throw an exception The type initializer for 'spr857' threw an exception
I tried to convert an Excel document to an PDF document using the free Spire.Xls component, and threw the exception "The type initializer for 'spr857' threw an exception" when I executed the second line of code below, which is to load the document.
Workbook workbook = new Workbook ()
Workbook.LoadFromFile ("D:\\ sample.xlsx")
Workbook.SaveToFile ("D:\\ sample.pdf", Spire.Xls.FileFormat.PDF)
This problem bothered me for a long time, and I couldn't find its solution on the Internet. Later, I visited the forum of E-iceblue Company and found its solution. The technical staff of E-iceblue Company replied: please make sure Spire.pdf.dll file is placed in the same location as Spire.xls.dll.
According to this meaning, I have tried two solutions, both of which can solve this problem. I would like to share them here:
Option 1, copy the Spire.pdf.dll file in the Spire.Xls package to the same directory as Spire.Xls.dll.
Scenario 2, import Spire.XLS.dll and Spire.Pdf.dll into the project as Reference at the same time.
The result of the conversion is perfect:
Original Excel:
The converted PDF:
While using Spire.Xls, I also encountered the same problem when I tried to use free Spire.Doc to convert Word documents to PDF documents, and the above two schemes also apply to Spire.Doc components.
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.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.