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

Free Support Forum - aspose.com

How to Add new row in existing table in pdf or change values of empty cell in table

Would like to add new cell Or Row in existing table.
using below code for .net ,it’s working for the cell which have already value but for empty cell it’s not working

// Create TableAbsorber object to find tables
TableAbsorber absorber = new TableAbsorber();

        // Visit first page with absorber
        absorber.Visit(pdfDocument.Pages[1]);
        AbsorbedTable table1 = absorber.TableList[0];
        int i = 0;
        foreach (var row in table1.RowList)
        {
            foreach (var cell in row.CellList)
            {
                if (cell.TextFragments.Count>0)
                cell.TextFragments[1].Text = $"Hi{i++}";
                else
                {
                    
                    var text = new TextFragment($"Hi{i++}");
                    text.Position = new Position(cell.Rectangle.LLX,cell.Rectangle.LLY);
                    text.BaselinePosition = text.Position;
                    text.TextState.ForegroundColor = Color.Red;
                    cell.TextFragments.Add(text);
                }
            }
        }

@hardikmenatq

Could you please share your sample PDF document with us so that we can test the scenario in our environment and address it accordingly.

Template.pdf (48.3 KB)

@hardikmenatq

We were able to reproduce the issue in our environment while using Aspose.PDF for .NET 20.8 and logged it as PDFNET-48720 in our issue tracking system. We will further look into its details and keep you informed with the status of its rectification. Please be patient and spare us some time.

We are sorry for the inconvenience.