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.

Mon Dec 14, 2015 9:02 am

I have a document in which some text is replaced, and after saving it to docx or pdf, I get the exceptions below.
I can't provide you with a file to reproduce the error (it doesn't fail before replacing the text) but I think the stacktraces speak for themselves. It seems the error may be related to "Mailto:" hyperlinks of an e-mail address in combination with something else. The exception does not occur when the link is removed, but it also does not occur when other parts of the text are removed.

I've tested using:
Spire.Doc Pack(hot fix) Version:5.5.189 (See pdf and docx stacktraces)
Spire.office 2.12.5 Spire.Doc 5.5.114.4035 (See pdf and docx stacktraces)
Spire office 2.8.2 Spire Doc 5.1.13.4035 (Docx works, pdf gets another exception, see this support thread)

.NET 3.5, Windows 10, Office 2013

Thank you,
Robin

To Docx with Spire.Doc Pack(hot fix) Version:5.5.189:

Code: Select all
{System.ArgumentOutOfRangeException: Index and length must refer to a location within the string.
Parameter name: length
   at System.String.Substring(Int32 startIndex, Int32 length)
   at Spire.Doc.Fields.TextRange.get_Text()
   at Spire.Doc.Fields.Field.ᜃ(DocumentObject A_0)
   at Spire.Doc.Fields.Field.ᜃ()
   at Spire.Doc.Fields.Field.᜕()
   at sprᧈ.ᜂ(Field A_0)
   at sprᧈ.ᜉ(Field 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ᧈ.ᜀ(Document A_0)
   at sprᧈ.ᜀ(Stream A_0, Document A_1)
   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 ......

To Pdf with Spire.Doc Pack(hot fix) Version:5.5.189:

Code: Select all
{System.ArgumentOutOfRangeException: startIndex cannot be larger than length of string.
Parameter name: startIndex
   at System.String.Substring(Int32 startIndex, Int32 length)
   at Spire.Doc.Fields.TextRange.get_Text()
   at Spire.Doc.Fields.TextRange.ᜀ()
   at Spire.Doc.Fields.TextRange.᜴()
   at Spire.Doc.Fields.TextRange.CreateLayoutInfo()
   at Spire.Doc.DocumentBase.Spire.Doc.Layout.IDocumentBase.get_LayoutInfo()
   at sprᥩ.ᜃ()
   at sprᥩ.ᜀ(RectangleF 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)
   at sprᥩ.ᜀ(RectangleF A_0)
   at sprស.ᜀ(spr᝾ A_0, sprấ A_1, spr⃆ A_2)
   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 ......


To Docx with Spire.office 2.12.5 Spire.Doc 5.5.114.4035:

Code: Select all
System.ArgumentOutOfRangeException: Index and length must refer to a location within the string.
Parameter name: length
   at System.String.Substring(Int32 startIndex, Int32 length)
   at Spire.Doc.Fields.TextRange.get_Text()
   at Spire.Doc.Fields.Field.3(DocumentObject A_0)
   at Spire.Doc.Fields.Field.3()
   at Spire.Doc.Fields.Field.21()
   at spr8082.2(Field A_0)
   at spr8082.9(Field A_0)
   at spr8082.8(ParagraphBase A_0)
   at spr8082.0(ParagraphItemCollection A_0)
   at spr8082.0(Paragraph A_0, Boolean A_1)
   at spr8082.0(BodyRegion A_0, Boolean A_1)
   at spr8082.0(BodyRegionCollection A_0, Boolean A_1)
   at spr8082.7(Section A_0)
   at spr8082.39()
   at spr8082.49()
   at spr8082.0(Document A_0)
   at spr8082.0(Stream A_0, Document A_1)
   at Spire.Doc.Document.6(Stream A_0)
   at Spire.Doc.Document.SaveToFile(Stream stream, FileFormat fileFormat)
   at Spire.Doc.Document.SaveToStream(Stream stream, FileFormat fileFormat)
   at .....


To Pdf with Spire.office 2.12.5 Spire.Doc 5.5.114.4035:
Code: Select all
System.ArgumentOutOfRangeException: startIndex cannot be larger than length of string.
Parameter name: startIndex
   at System.String.Substring(Int32 startIndex, Int32 length)
   at Spire.Doc.Fields.TextRange.get_Text()
   at Spire.Doc.Fields.TextRange.CreateLayoutInfo()
   at Spire.Doc.DocumentBase.Spire.Doc.Layout.IDocumentBase.get_LayoutInfo()
   at spr8536.3()
   at spr8536.0(RectangleF A_0)
   at spr7982.3(spr7392 A_0)
   at spr8536.0(RectangleF A_0)
   at spr8536.3(spr7392 A_0)
   at spr8536.0(RectangleF A_0)
   at spr8536.3(spr7392 A_0)
   at spr8536.0(RectangleF A_0)
   at spr4900.0(spr6629 A_0, spr5719 A_1, spr6619 A_2)
   at spr4448.21()
   at spr4448.1(IDocument A_0)
   at spr2464.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)
   at ....

robinvos
 
Posts: 22
Joined: Thu Oct 08, 2015 8:43 am

Tue Dec 15, 2015 2:45 am

Hi,

Thanks for your inquiry.
It is very difficult to resolve the issues if we don't have your original document for investigation. The issues may be not just "Mailto:" hyperlinks of an e-mail address caused and may be related to others elements around it or document structure.
You can send it to amy.zhao@e-iceblue.com if it cannot be shared here. And please share your code.

Please kindly note that we take customer's confidential information as serious as them. We will never publish or disclose any information of our customer. This is always the promise we keep to our customer and the regulation we must obey.

You also provide us an example document doesn't include confidential information and can reproduce the error.
Thank you.

Best Regards,
Amy
E-iceblue support team
User avatar

amy.zhao
 
Posts: 2766
Joined: Wed Jun 27, 2012 8:50 am

Wed Feb 24, 2016 9:03 am

Hi,

Can you please look into this again?

I've sent you a Visual Studio solution via e-mail to reproduce the exception, but I haven't heard anything since. That was more than 2 months ago.

Btw, my employer has now renewed our Spire license, which comes with 'priority support'. If you'd like to verify this, send me an e-mail.

I've created a simpler solution to reproduce the exception, see attached zip file. It seems that vertical tabs (\v in code or shift-enters in Word) cannot be replaced in this case.

I've tested using the newest Spire.Office version 2.13 (Spire.Doc.dlll v5.6.17.40.35) using .NET 3.5, and it still occurs.

Thank you.

Reproduce Spire Exception.zip

robinvos
 
Posts: 22
Joined: Thu Oct 08, 2015 8:43 am

Thu Feb 25, 2016 3:45 am

Hi,

Thanks for your posting.
I checked our e-mails but didn't receive your e-mail with your Visual Studio solution, and have reproduced your issue with enclosed solution here, sorry for the inconvenience that the issue brought to you. I have verified your license for Spire.Office, yes, it has renewed. Our dev team is working on it. We will inform you when it is resolved.

Best Regards,
Amy
E-iceblue support team
User avatar

amy.zhao
 
Posts: 2766
Joined: Wed Jun 27, 2012 8:50 am

Thu Feb 25, 2016 6:17 am

Hi,

The issue has been resolved. We will inform you when new version of Spire.Office is released.

Best Regards,
Amy
E-iceblue support team
User avatar

amy.zhao
 
Posts: 2766
Joined: Wed Jun 27, 2012 8:50 am

Fri Mar 11, 2016 6:44 am

Hello,

Thanks for your waiting. Here is a new hotfix you can download and have a try.
http://www.e-iceblue.com/downloads/Temp ... 2.13.2.zip
Sincerely,
Gary
E-iceblue support team
User avatar

Gary.zhang
 
Posts: 1380
Joined: Thu Apr 04, 2013 1:30 am

Fri Mar 11, 2016 3:13 pm

Hello,

The exception occurs less often but with 2.13.2 I can still reproduce this exception with another document (only when saving to PDF).

I will send the code and Word file to Amy as I don't have your address, Gary.

Best regards,
Robin

Code: Select all
System.ArgumentOutOfRangeException occurred
  Message=Index was out of range. Must be non-negative and less than the size of the collection.
Parameter name: index
  Source=mscorlib
  ParamName=index
  StackTrace:
       at System.ThrowHelper.ThrowArgumentOutOfRangeException(ExceptionArgument argument, ExceptionResource resource)
       at System.ThrowHelper.ThrowArgumentOutOfRangeException()
       at System.Collections.Generic.List`1.get_Item(Int32 index)
       at System.Collections.Generic.List`1.System.Collections.IList.get_Item(Int32 index)
       at Spire.Doc.Collections.ParagraphItemCollection.get_Item(Int32 index)
       at Spire.Doc.Hyperlink.3()
       at Spire.Doc.Hyperlink.4()
       at Spire.Doc.Hyperlink..ctor(Field hyperlink)
       at Spire.Doc.Fields.Field.Spire.Doc.Layout.IDocumentWidget.Measure(spr6671 dc)
       at spr1563.0(RectangleF A_0)
       at spr8591.3(spr7437 A_0)
       at spr8591.0(RectangleF A_0)
       at spr8033.3(spr7437 A_0)
       at spr8591.0(RectangleF A_0)
       at spr8591.3(spr7437 A_0)
       at spr8591.0(RectangleF A_0)
       at spr8591.3(spr7437 A_0)
       at spr8591.0(RectangleF A_0)
       at spr4937.0(spr6681 A_0, spr5772 A_1, spr6671 A_2)
       at spr4482.17()
       at spr4482.1(IDocument A_0)
       at spr2476.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)

robinvos
 
Posts: 22
Joined: Thu Oct 08, 2015 8:43 am

Mon Mar 14, 2016 2:56 am

Hi,

I have received your project and reproduced the error, sorry for the inconvenience. The issue has been forwarded to our dev team.
We will inform you when it is resolved.

Best Regards,
Amy
E-iceblue support team
User avatar

amy.zhao
 
Posts: 2766
Joined: Wed Jun 27, 2012 8:50 am

Thu Apr 07, 2016 7:18 am

Hi,

Thanks for waiting.
The issue has been resolved. Welcome to download and test Spire.Office Platinum (Hot Fix) Version:2.13.4.

Best Regards,
Amy
E-iceblue support team
User avatar

amy.zhao
 
Posts: 2766
Joined: Wed Jun 27, 2012 8:50 am

Thu Apr 07, 2016 10:01 am

Hi,

Spire Office 2.13.4 has resolved the issue.

Thanks

robinvos
 
Posts: 22
Joined: Thu Oct 08, 2015 8:43 am

Fri Apr 08, 2016 1:43 am

Hi,

I am glad to hear that. Welcome to feel free to write to us if you have further problems.

Best Regards,
Amy
E-iceblue support team
User avatar

amy.zhao
 
Posts: 2766
Joined: Wed Jun 27, 2012 8:50 am

Return to Spire.Doc