Invalid index in Rows indexer: 0

Hi All,

I am using Aspose.Pdf dll to generate PDF document.I am getting the issue that “Invalid index in Rows indexer: 0” while generating the PDF.

Where I am getting Issue/Error:
There is a table with many number of rows while generating PDF. Its a for loop to add each row with data in table. Here I am using fontsize 11 to display the text in each row table. The issue is getting here that “Invalid index in Rows indexer: 0” randomly. But not frequently. If I reduce the font size to some 5 number down, then its working without any issue. some code snippet is pasting here. I hope you all understood the issue.

row = pdfTableResourceTeam.Rows.Add();
Cell cellRole = row.Cells.Add();
Text textRole = new Text(teamMemberTable.Rows[count][“Role”].ToString());
Aspose.Pdf.TextInfo txtinfoRole = textRole.TextInfo.Clone() as Aspose.Pdf.TextInfo;
txtinfoRole.FontSize = 8;
txtinfoRole.Color = col;
textRole.TextInfo = txtinfoRole;
cellRole.Paragraphs.Add(textRole);



Any fix for this? Any solution for this defect?

Please help me.

Thanks and Regards
Prathap Reddy

Hello Prathap,


Thanks for using our products.

In order for us to replicate this problem, we need to know the number of rows that you are trying to add to the table and the length/contents being placed inside table cells. If possible, can you please share some sample application which can help us in testing this scenario at our end. We are really sorry for your inconvenience.

Hi Nayyer Shahbaz,

Thanks for your reply.

The number of rows are 15. It may increase or decrease based on data.
The content in the cell is simple text. The text does not contain number of line. Its just name of person.
Font size is 11.

Not possible to share the code. The sample snippet is already placed in my first post. Check the same.

If I change the font then its working. Its generating PDF file. But I don’t want to change the font size. All text in PDF should be in the same font size. that is 11.

Any help?

Thanks and Regards
Prathap

Hello Prathap,


Thanks for sharing the details.

I have tried reproducing the issue while using following code snippet but I am unable to notice the problem. I have tested the scenario using Aspose.Pdf for .NET 6.9.0 and PDF file is properly being generated. For your reference, I have also attached the resultant PDF that I have generated. Can you please help us in replicating this problem . We are really sorry for this inconvenience.

[C#]
// instantiate PDF object
Aspose.Pdf.Generator.Pdf pdf = new Aspose.Pdf.Generator.Pdf();
// create section obejct and add it to pdf document
Aspose.Pdf.Generator.Section section = pdf.Sections.Add();
Aspose.Pdf.Generator.Table pdfTableResourceTeam = new Aspose.Pdf.Generator.Table();
// set the column width information for table cells
pdfTableResourceTeam.ColumnWidths = “50”;
// set the border style for table object
pdfTableResourceTeam.Border = new Aspose.Pdf.Generator.BorderInfo((int)BorderSide.All,0.3f);
pdfTableResourceTeam.DefaultCellBorder = new Aspose.Pdf.Generator.BorderInfo((int)BorderSide.All, 0.3f);
// add the table to paragraphs collection of section
section.Paragraphs.Add(pdfTableResourceTeam);
for (int i = 0; i < 15; i++)
{
Aspose.Pdf.Generator.Row row = pdfTableResourceTeam.Rows.Add();
Cell cellRole = row.Cells.Add();
Text textRole = new Text(“Role-text”);
Aspose.Pdf.Generator.TextInfo txtinfoRole = new Aspose.Pdf.Generator.TextInfo();
txtinfoRole.FontSize =11;
txtinfoRole.Color = new Aspose.Pdf.Generator.Color(“Blue”);
textRole.TextInfo = txtinfoRole;
cellRole.Paragraphs.Add(textRole);
}
// save the reusltant Pdf file
pdf.Save(@“D:\pdftest\Sample_table.pdf”);

Hi Nayyer Shahbaz,

Thank you for your time and information.

Even I am getting the issue randomly but not always. My PDF file is having different sections with large data. I am not sure whether this issue will get for small PDF file generation.

I am using Aspose.Pdf dll version is 5.0.1.0. Is this issue because of using old version dll which may have this bug. Any idea on this? Meanwhile I will download latest Aspose.Pdf.dll and will test my issue. I will update you on this.

Thanks and Regards
Prathap

Hin Prathap,


In order for us to resolve a problem, first we need to replicate it at our end. However as you are using a quite older version, so I would suggest you to please try using the latest release. In case the issue still persists, please feel free to contact. We are sorry for your inconvenience.


Hi,

New version also does not work for my issue. Any other ideas?

Thanks and Regards
Prathap

Hi Prathap,<?xml:namespace prefix = o ns = "urn:schemas-microsoft-com:office:office" />

Thank you for the feedback.

However, as mentioned by Nayyer, we are not able to reproduce your issue at our end. Please create a sample application to reproduce the issue and post it here. This will help us reproduce the issue and rectify it.

Also, please share the details regarding your system environment i.e. OS, .NET Framework, 32 bit or 64 bit processor etc. so we can test your issue according to your system environment.

Sorry for the inconvenience,

Hi,


This has been driving me crazy so I took the time to put together a sample project for you. The project is VB.NET 3.5 and I’m using Aspose.PDF version 7.0. This is the same as our production environment.

I ran this sample on Windows 7 64 bit and our server os is Windows Server 2008 / 64 bit

If you select “smallest” and click the Print button, you will get a link to view the pdf.
If you select “largest” and click the Print button, you will get the error message.

The error received is:
System.ArgumentException: Invalid index in Rows indexer: 0 at Aspose.Pdf.Generator.Rows.get_Item(Int32 index) at ..(Pdf doc, Section currentPart, HeaderFooter hf, Table table,  assignInfo,  bakAssignInfo,  useType, Boolean isFirst, & breakTableNextPart) at ..(Pdf doc, Section currentPart, HeaderFooter hf, Table table,  assignInfo,  useType, Boolean isFirst, & breakTableNextPart) at ..(Pdf , Section ,  ) at .†.(Pdf ) at .Ž.( , Pdf ) at Aspose.Pdf.Generator.Pdf.Save(String pdfFile) at AsposeError._Default.btnPrint_Clicked(Object sender, EventArgs e) in C:\Users\Jonathan\Documents\Visual Studio 2010\Projects\AsposeError\AsposeError\Default.aspx.vb:line 26


The layout uses a table with 1 row and 2 cells. I believe the problem has something to do with the content in the left cell going over to the second page.

Please let me know if there is anything that can be done to correct this or if you need any more information from me.

Hi Prathap,<?xml:namespace prefix = o ns = "urn:schemas-microsoft-com:office:office" />

<o:p> </o:p>

Thank you for the details and sample application.<o:p></o:p>

<o:p> </o:p>

I am able to reproduce your mentioned issue after an initial test
using your sample application. For further investigation and rectification, I
have created an issue in our issue tracking system with issue id: PDFNEWNET-33761. Our development team
will further look into the cause of the exception. I will notify you via this
forum thread regarding any updates against your issue.<o:p></o:p>

<o:p> </o:p>

Sorry for the inconvenience,<o:p></o:p>

Hi Nausherwan,


Is there any way for me to keep up with the status of that issue or is that something that is only tracked internally? This issue affects us daily as people continue to get errors when trying to generate their profile. Any information would be greatly appreciated.


Hi John,

Thanks for your inquiry.

I have verified the status of this issue from our issue tracking system and regret to share that this issue is still unresolved and currently is pending for analysis. Moreover, I am very sorry to share with you that you cannot track the status of logged issues in our issue tracking system. Issues can be tracked internally. You can get the status of logged issues using forum threads.

Please feel free to contact support in case you need any further assistance.

Thanks & Regards,

Hi John,

I had a similar problem (same exception) and switching to version 6.7.0 has solved it.

Daniel

Hi Daniel,

Thanks for using our products and sorry for replying you late.

Our development team is working on this issue and you will be updated as soon as it is resolved. We are really sorry for this inconvenience.

Thanks & Regards,

G’day Rashid,


I am also receiving this error while trying to Save a pdf document, has there been a resolution to this issue?

(I am using Aspose PDF v7.4.0 .NET 4)

Thanks,
Matt

Hi Matt,<?xml:namespace prefix = o ns = "urn:schemas-microsoft-com:office:office" />

I am afraid; the issue is still not resolved. However, I have requested the development team to share an ETA regarding the resolution of this issue. As soon as I get a feedback, I will update you via this forum thread.

Sorry for the inconvenience,

Hi,

Any fix for this issue? Please let me know.

Thanks and Regards
Prathap

Hi Prathap,


Thanks for your inquiry. I’m afraid your reported issue is still not resolved due to some other priority tasks and it’s pending in the queue for analysis. However, I’ve requested the team for ETA and as soon as I get a feedback I will update you via this forum thread.

Sorry for the inconvenience faced.

Best Regards,

Any Fix for given Issue....

Thanks,

Vijay

Hi Vijay,


Thanks for your inquiry. I’m afraid the reported issue is still not resolved completely.

Moreover, can you please share some more details or sample code of the issue? As issue root cause can be vary from case to case.

We are sorry for the inconvenience caused.

Best Regards,