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 Jul 22, 2015 6:13 pm

I am getting the following exception when I try to call the SaveToFile(string fileName, FileFormat fileFormat) method.

The file name being passed is:
[Path Removed]\84bfd6ab-96f0-4801-8ba9-cf862f41829b\f8245b76-29f4-4060-bafb-c83ad02fc9e4\2590ad05-a1f2-4814-b4e8-785dc354e540_[File Name Removed].pdf.docx

The file format being used is:
FileFormat.Docx2010

The interesting thing about this is this is all standardized code used throughout our application. And the file that is failing is created along with 3 others, all of which are working correctly.

Any help would be greatly appreciated.

Exception:
{System.ArgumentOutOfRangeException: Length cannot be less than zero.
Parameter name: length
at System.String.InternalSubStringWithChecks(Int32 startIndex, Int32 length, Boolean fAlwaysCopy)
at System.String.Substring(Int32 startIndex, Int32 length)
at Spire.Doc.Fields.TextRange.get_Text()
at sprᦥ.ᜂ(ParagraphBase A_0)
at sprᦥ.ᜈ(ParagraphBase A_0)
at sprᦥ.ᜀ(ParagraphItemCollection A_0)
at sprᦥ.ᜀ(Paragraph A_0, Boolean A_1)
at sprᦥ.ᜀ(BodyRegion A_0, Boolean A_1)
at sprᦥ.ᜀ(BodyRegionCollection A_0, Boolean A_1)
at sprᦥ.ᜇ(Section A_0)
at sprᦥ.ᜥ()
at sprᦥ.ᜯ()
at sprᦥ.ᜀ(Stream A_0, Document A_1)
at sprᦥ.ᜀ(String A_0, Document A_1)
at Spire.Doc.Document.ᜈ(String A_0)
at Spire.Doc.Document.SaveToFile(String fileName, FileFormat fileFormat)
at [Namespace Removed].LetterParser.ProcessLetter(LetterData letterData, Letter letter) in [File Removed]:line 180}

sbrauen
 
Posts: 2
Joined: Wed Jul 22, 2015 6:04 pm

Thu Jul 23, 2015 2:57 am

Dear sbrauen,

Thanks for your inquiry.
Please provide us your sample document here, or you can send it to us( [email protected]) via email. It would be very helpful to investigate this issue.

Thanks,
Betsy
E-iceblue support team
User avatar

Betsy
 
Posts: 802
Joined: Mon Jan 19, 2015 6:14 am

Thu Jul 23, 2015 12:44 pm

Unfortunately, we figured out a work around to the problem. By adding a space or two to the template and then resaving the document it fixed whatever the issue was.

sbrauen
 
Posts: 2
Joined: Wed Jul 22, 2015 6:04 pm

Fri Jul 24, 2015 1:27 am

Dear sbrauen,

Thanks for your response. I am glad to hear that your issue has been resolved. Please feel free to contact us if you have any questions or needs. We are here for help.

Sincerely,
Betsy
E-iceblue support team
User avatar

Betsy
 
Posts: 802
Joined: Mon Jan 19, 2015 6:14 am

Return to Spire.Doc