Dimitris Payroll
Dimitris Payroll

Reputation: 1

Docx ( Xceed ) .NET library styling issue on a dynamic fields

   for (int i = 0; i < pairs.Count; i++)
                {
                    if (i == 0)
                    {
                        FindAndReplace(document, "temp9", pairs[i][0]);
                        FindAndReplace(document, "temp14", pairs[i][1]);
                        FindAndReplace(document, "temp15", "1");
                    }
                    else
                    {
                        Table table = document.AddTable(1, 1);
                        table.SetWidths(new float[] { 5000 });
                        table.Design = TableDesign.None;
                        table.Rows[0].Cells[0].Paragraphs.First().Append("");

                        foreach (var row in table.Rows)
                        {
                            foreach (var cell in row.Cells)
                            {
                                cell.SetBorder(TableCellBorderType.Bottom, new Border(BorderStyle.Tcbs_single, BorderSize.one, 1, System.Drawing.Color.Black));
                            }
                        }

                        document.InsertTable(table);

                        temp9Paragraph.AppendLine(pairs[i][0]);
                        temp14Paragraph.AppendLine(pairs[i][1]);
                        temp15Paragraph.AppendLine("1");
                    }
                }

You can imagine it as a diary where temp9 is replaced by the date and temp14 is replaced by my thoughts ( some text ) i just wanna seperate each entry by line instead of looking like the screenshot i provided.

tried asking chatgpt how to fix my issue, since my problem is niche, but every answer was a dead end

Upvotes: 0

Views: 72

Answers (0)

Related Questions