Spire.Doc is a professional Word .NET library specifically designed for developers to create, read, write, convert and print Word document files. Get free and professional technical support for Spire.Doc for .NET, Java, Android, C++, Python.

Wed Feb 20, 2019 3:42 pm

Hello,
I have a problem with conversion from DOCX to PDF. Some files throw this exception:

System.FormatException: Input string was not in a correct format.
at System.Number.ParseSingle(String value, NumberStyles options, NumberFormatInfo numfmt)
at spr6654.1(TextureStyle A_0, Color A_1, Color A_2, RectangleF A_3)
at spr6654.0(TableCell A_0, spr8810 A_1)
at Spire.Doc.TableCell.Spire.Doc.Layout.IDocumentBase.Draw(spr6654 dc, spr8810 ltWidget)
at spr8810.0(spr6654 A_0)
at spr8810.0(spr6654 A_0)
at spr8810.0(spr6654 A_0)
at spr8810.0(spr6654 A_0)
at spr8810.0(spr6654 A_0)
at spr894.0(spr6654 A_0)
at spr4471.0(Int32 A_0, Int32 A_1, ImageType A_2, MemoryStream A_3, Boolean A_4, Boolean A_5, Boolean A_6)
at spr2475.1(spr4471 A_0)
at spr2475.0(Document A_0)
at Spire.Doc.Document.0(Stream A_0)
at Spire.Doc.Document.SaveToFile(Stream stream, FileFormat fileFormat)
at Spire.Doc.Document.SaveToStream(Stream stream, FileFormat fileFormat)

Code snippet:
Code: Select all
var fileName = "Doc2.docx";
using (var stream = File.OpenRead(fileName))
using (var docTemplate = new Document(stream))
using (var finalDocument = new MemoryStream())
{
     docTemplate.SaveToStream(finalDocument, FileFormat.PDF);
     File.WriteAllBytes(Path.GetFileNameWithoutExtension(fileName) + ".pdf", finalDocument.ToArray());
}


Versions of DLLs:
Spire.Common: 1.2.346.4040
Spire.Doc: 5.6.17.4040
Spire.Licence: 1.3.5.40
Spire.Pdf: 3.6.131.4040

Is it any known issue in this version of the Spire.Doc.DLL?
Thanks

ales.klenka
 
Posts: 9
Joined: Thu Mar 22, 2012 9:30 am

Thu Feb 21, 2019 2:17 am

Hello,

Thanks for your post.
The version you used is very old, I suggest you download our latest Spire.Doc Pack(hot fix) Version:7.1.19 to test again. If your issue still occurs after trying, please provide your input file (Doc2.docx) to help us further look into it. You could send it to us via email(support@e-iceblue.com).

Sincerely,
Lisa
E-iceblue support team
User avatar

Lisa.Li
 
Posts: 1261
Joined: Wed Apr 25, 2018 3:20 am

Fri Feb 22, 2019 8:53 am

Hello,

Greetings from E-iceblue.
Could you please let us know how is your issue going? Thanks in advance.

Sincerely,
Lisa
E-iceblue support team
User avatar

Lisa.Li
 
Posts: 1261
Joined: Wed Apr 25, 2018 3:20 am

Fri Feb 22, 2019 1:16 pm

Hello, I used the latest version (hotfix) and it's still the same situation. I attached the DOCX file.

Code: Select all
using (var docTemplate = new Document(fileName, FileFormat.Auto))
{
    docTemplate.SaveToFile(Path.GetFileNameWithoutExtension(fileName) + ".pdf");
}


Spire.Doc.DLL: 7.2.4.4040
Spire.License.DLL: 1.3.7.40
Spire.Pdf.DLL: 5.2.8.19040

ales.klenka
 
Posts: 9
Joined: Thu Mar 22, 2012 9:30 am

Mon Feb 25, 2019 2:47 am

Hello,

Thank you so much for sharing.
I tested your sample word document, but I didn't reproduce the FormatException you encountered. I just did notice that the generated PDF file exists some issues on content format(please refer to the attached screenshot). These issues have been submitted to our Dev team for further investigating and fixing. Here, I made a demo for you, please run it on your side and then let us know your testing result. If the FormatException still occurs, please provide your system configuration (E.g. Win7 64 bit) and region settings(E.g. China/Chinese) to help further look into your issue.

Sincerely,
Lisa
E-iceblue support team
User avatar

Lisa.Li
 
Posts: 1261
Joined: Wed Apr 25, 2018 3:20 am

Mon Feb 25, 2019 1:49 pm

Hello, please try add to your code as first this lines (change local settings for the actual thread):

Thread.CurrentThread.CurrentUICulture = new CultureInfo(1029);
Thread.CurrentThread.CurrentCulture = new CultureInfo(1029);

I thing, the CurrentCulture is the problem, we use Czech local settings ("cs-CZ").

ales.klenka
 
Posts: 9
Joined: Thu Mar 22, 2012 9:30 am

Tue Feb 26, 2019 2:34 am

Hello Ales,

Thanks for your quick reply.
Using the Czech settings ("cs-CZ"), it indeed exists the FormatException to convert your word document. Sorry for the inconvenience caused, this issue also has been logged into our bug tracking system for further investigating and fixing. We will keep you posted if there is any update.

Sincerely,
Lisa
E-iceblue support team
User avatar

Lisa.Li
 
Posts: 1261
Joined: Wed Apr 25, 2018 3:20 am

Thu Mar 14, 2019 9:46 am

Hello Ales,

Thanks for your patient waiting.
Glad to inform that the FormatException about using Czech settings ("cs-CZ") has been fixed. Please download the hotfix Spire.Office Version:4.3.1 to have a test. Besides, Our Dev team are making efforts to fix the content format issues of generated PDF, once the hotfix version is available, we will let you know immediately.

Sincerely,
Lisa
E-iceblue support team
User avatar

Lisa.Li
 
Posts: 1261
Joined: Wed Apr 25, 2018 3:20 am

Thu Jan 09, 2020 9:36 am

ConvertToPdfSpire.zip
Hello,
I have another a problem with conversion from DOCX to PDF. I attached whole project with files Document1.docx and Document2.Docx. Each file throws another exception. We use the latest version of the SpireOffice.NET for .NET Framework 4.0. from package SpireOffice.NET version 4.12.6.
Exceptions:
Document1.docx
System.NullReferenceException: Object reference not set to an instance of an object.
at spr⪡.ᜆ(spr⪌ A_0)
at spr⪡.ᜈ(spr⪌ A_0)
at spr⪌.ᜅ()
at spr⪕.ᜀ()
at spr⪕.ᜃ()
at spr⪕.ᜀ(Stream A_0, Document A_1, spr⤑ A_2)
at Spire.Doc.Document.᜗(Stream A_0)
at Spire.Doc.Document.LoadFromStream(Stream stream, FileFormat fileFormat, String password)
at Spire.Doc.Document..ctor(Stream stream)
at ConvertToPdf.Program.Main(String[] args) in C:\PST\Samples\ConvertToPdf\ConvertToPdfSpire\Program.cs:line 27

Document2.docx
System.NullReferenceException: Object reference not set to an instance of an object.
at Spire.Doc.Document.ᜃ(ListFormat A_0, String A_1)
at Spire.Doc.Documents.Paragraph.ResetLayoutInfo()
at spr⑴.ᜇ(spr⑳ A_0)
at spr⑴.ᜊ(spr⑳ A_0)
at spr⑴.ᜁ(RectangleF A_0)
at spr⑴.ᜋ(spr⑳ A_0)
at spr⑴.ᜁ(RectangleF A_0)
at spr⑧.ᜀ(spr⑞ A_0, spr⑘ A_1, spr⣋ A_2)
at spr⣃.ᜒ()
at spr⣃.ᜓ()
at spr⣃.ᜀ(IDocument A_0)
at spr⣮.ᜀ(Document A_0)
at Spire.Doc.Document.ᜂ(Stream A_0)
at Spire.Doc.Document.SaveToFile(Stream stream, FileFormat fileFormat)
at Spire.Doc.Document.SaveToStream(Stream stream, FileFormat fileFormat)
at ConvertToPdf.Program.Main(String[] args) in C:\PST\Samples\ConvertToPdf\ConvertToPdfSpire\Program.cs:line 30

ales.klenka
 
Posts: 9
Joined: Thu Mar 22, 2012 9:30 am

Thu Jan 09, 2020 10:38 am

Hi,

Thanks for your inquiry.
I have reproduced your issue and posted it to our Dev team. Once there is any progress, we will let you know.
Sorry for the inconvenience caused.

Best wishes,
Amber
E-iceblue support team
User avatar

Amber.Gu
 
Posts: 525
Joined: Tue Jun 04, 2019 3:16 am

Fri Jan 17, 2020 7:12 am

Hello, is there any progress?

Thank you for reply.

ales.klenka
 
Posts: 9
Joined: Thu Mar 22, 2012 9:30 am

Fri Jan 17, 2020 7:42 am

Hi,

Thanks for your reply.
I checked the state of your issue in our bug tracking system. Sorry that it has not been resolved yet. Please share us little more tome, once there is any progress, we will inform you ASAP.
Sorry for the inconvenience caused.

Best wishes,
Amber
E-iceblue support team
User avatar

Amber.Gu
 
Posts: 525
Joined: Tue Jun 04, 2019 3:16 am

Tue Mar 17, 2020 8:25 am

Hello, is there any progress? Thx

ales.klenka
 
Posts: 9
Joined: Thu Mar 22, 2012 9:30 am

Tue Mar 17, 2020 10:24 am

Hello,

Thanks for your following up.
Sorry our Dev team is still fixing your issue at present. Anyway, we have given your issue the highest priority and requested our Dev team to share any possible ETA at their earliest time. Once it is fixed, we will notify you ASAP.
Apologize for the delay and inconvenience caused.

Sincerely,
Rachel
E-iceblue support team
User avatar

rachel.lei
 
Posts: 1571
Joined: Tue Jul 09, 2019 2:22 am

Thu Mar 26, 2020 7:52 am

Hello,

Thanks for your patient waiting.
Glad to tell that your issue has been fixed now. Welcome to download the newly released Spire.Office Platinum Version:5.3.7 from the following link.
Website link: https://www.e-iceblue.com/Download/down ... t-now.html
Nuget link: https://www.nuget.org/packages/Spire.Office/5.3.7

Sincerely,
Rachel
E-iceblue support team
User avatar

rachel.lei
 
Posts: 1571
Joined: Tue Jul 09, 2019 2:22 am

Return to Spire.Doc