We're sorry Aspose doesn't work properply without JavaScript enabled.

Free Support Forum - aspose.com

Getting "Index was out of bound" exception when trying to set border of cell in a table

I am working on a project where I am generating PDF from .Net using Aspose. I have nested tables and in the nested table, I have a cell where I am trying to set border of it but facing exception at pdf.processParagraphs() method. Please help.

Here is my code snippet:

var SystemHealthTable = new Table
{
ColumnWidths = “100 80”,
DefaultCellPadding = new MarginInfo { Bottom = 3, Top = 3 },
Margin = { Top = 8 }
};

        var systemHealthRow = SystemHealthTable.Rows.Add();

        var systemHealthHeaderCell = systemHealthRow.Cells.Add();
        var nameHeader = new TextFragment("System Name");
        systemHealthHeaderCell.Paragraphs.Add(nameHeader);

        var systemHealthHeaderCell2 = systemHealthRow.Cells.Add();
        systemHealthHeaderCell2.Border = new BorderInfo(BorderSide.Right, Color.Black);
        
        var technicalHeader = new TextFragment("Technical");
        technicalHeader.TextState.HorizontalAlignment = HorizontalAlignment.Right;
        systemHealthHeaderCell2.Paragraphs.Add(technicalHeader);


        var systemHealthHeaderCell3 = systemHealthRow.Cells.Add();
        systemHealthHeaderCell3.Border = new BorderInfo(BorderSide.Right, Color.Black);
        var functionalHeader = new TextFragment("Functional");
        functionalHeader.TextState.HorizontalAlignment = HorizontalAlignment.Right;
        systemHealthHeaderCell3.Paragraphs.Add(functionalHeader);

@prit25

Thank you for contacting support.

Would you please share source PDF document, if any, and SSCCE code as shared code snippet does not include pdf.processParagraphs() method. We will try to reproduce and investigate it in our environment.