Free Support Forum - aspose.com

Error: Index and length must refer to a location within the string. Parameter name: length

Hi all,

i’m using the evaluation edition to test aspose controls to choose for a project of our company.

When i convert a MSWord file with a table with about 20 rows i get this error.

Index and length must refer to a location within the string. Parameter name: length

Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.

Exception Details: System.ArgumentOutOfRangeException: Index and length must refer to a location within the string. Parameter name: length

Source Error:

Line 115: Line 116: 'Now produce the PDF file. Line 117: pdf.Save(“Aspose.Word.Demos.pdf”, Aspose.Pdf.SaveType.OpenInBrowser, Me.Response) Line 118: End Sub Line 119:

Source File: D:\wwwProjects\XSLTOnline2\WebAppLocat\Viewer.aspx.vb Line: 117

Stack Trace:

[ArgumentOutOfRangeException: Index and length must refer to a location within the string. Parameter name: length] System.String.Substring(Int32 startIndex, Int32 length) +226 Aspose.Pdf.Xml.b.a(Pdf A_0, Section A_1, Table A_2, Row A_3, Cell A_4, Text A_5, a A_6, y A_7, Boolean A_8) Aspose.Pdf.Xml.j.a(Pdf A_0, Section A_1, Table A_2, Row A_3, Cell A_4, a A_5) Aspose.Pdf.Xml.ah.a(Pdf A_0, Section A_1, Table A_2, Row A_3, a A_4) Aspose.Pdf.Xml.am.a(Pdf A_0, Section A_1, Table A_2, a A_3, Boolean A_4) Aspose.Pdf.Xml.v.a(Pdf A_0, Section A_1, a A_2) Aspose.Pdf.Xml.au.a(Pdf A_0) Aspose.Pdf.Xml.ac.a(a A_0, Pdf A_1) Aspose.Pdf.Pdf.Save(String fileName, SaveType saveType, HttpResponse response) WebAppLocat.Viewer.SendToBrowserAsPdf(Document doc) in D:\wwwProjects\XSLTOnline2\WebAppLocat\Viewer.aspx.vb:117 WebAppLocat.Viewer.SendToBrowser(Document doc, String outputFormat) in D:\wwwProjects\XSLTOnline2\WebAppLocat\Viewer.aspx.vb:83 WebAppLocat.Viewer.Page_Load(Object sender, EventArgs e) in D:\wwwProjects\XSLTOnline2\WebAppLocat\Viewer.aspx.vb:59 System.Web.UI.Control.OnLoad(EventArgs e) +67 System.Web.UI.Control.LoadRecursive() +35 System.Web.UI.Page.ProcessRequestMain() +731 
If i convert a simple doc all work fine.

May be is the same problem of the post
"Invalid Index" Error Saving PDF from HTML File on Server

Could you explain what is the problem?

This question is a focal point of our software selection.

Thank you

Dear maxdl,

Thank you for considering Aspose.

Can you please send your document to me?

Dear maxdl,

Thank you for considering Aspose.

I have fixed this bug. Please download hotfix here.

Hi,

i have used the patch posted by you.

But the problem cotinue with diferent specification:

Server Error in ‘/WebAppLocat’ Application.

Index and length must refer to a location within the string. Parameter name: length

Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.

Exception Details: System.ArgumentOutOfRangeException: Index and length must refer to a location within the string. Parameter name: length

Source Error:

An unhandled exception was generated during the execution of the current web request. Information regarding the origin and location of the exception can be identified using the exception stack trace below.

Stack Trace:

[ArgumentOutOfRangeException: Index and length must refer to a location within the string. Parameter name: length] Microsoft.VisualBasic.CompilerServices.LateBinding.InternalLateCall(Object o, Type objType, String name, Object[] args, String[] paramnames, Boolean[] CopyBack, Boolean IgnoreReturn) +791 Microsoft.VisualBasic.CompilerServices.LateBinding.LateCall(Object o, Type objType, String name, Object[] args, String[] paramnames, Boolean[] CopyBack) +23 WebAppLocat.Viewer.SendToBrowserAsPdf(Document doc) in D:\wwwProjects\XSLTOnline2\WebAppLocat\Viewer.aspx.vb:135 WebAppLocat.Viewer.SendToBrowser(Document doc, String outputFormat) in D:\wwwProjects\XSLTOnline2\WebAppLocat\Viewer.aspx.vb:87 WebAppLocat.Viewer.Page_Load(Object sender, EventArgs e) in D:\wwwProjects\XSLTOnline2\WebAppLocat\Viewer.aspx.vb:62 System.Web.UI.Control.OnLoad(EventArgs e) +67 System.Web.UI.Control.LoadRecursive() +35 System.Web.UI.Page.ProcessRequestMain() +731 

I just sent an email to you with the document and the xml generated from the

doc.Save(stream, SaveFormat.FormatAsposePdf)

instrution.

I hope you can solve this problem.

Thank you

Hi,

Thank you for considering Aspose.

I have tested your example and have not found any error. Please make sure your are using the latest version of Aspose.Pdf (2.1.3.5).