I have been trying multiple ways (In Apose.PDF for .Net 19.9.0) to get a 2 column layout (left being the header/section, and right being the content) over multiple pages in c#. However, each method I have tried is causing some issue.
1. Tables
This looked to be working fine until I realised that text was being intermittently cut off, even though rows were allowed to break across pages. There is a lot of content for each header/section and every method of using a table for the layout for large character counts has resulted in intermittent trimming of content text. Example below:
Aspose.Pdf.Table table = new Aspose.Pdf.Table();
table.Margin.Top = 10;
table.DefaultColumnWidth = ((PageWidth / 4) - 30).ToString();
table.DefaultCellPadding = new MarginInfo();
table.DefaultCellPadding.Left = 0;
table.DefaultCellPadding.Right = 0;
table.DefaultCellPadding.Top = 5;
table.DefaultCellPadding.Bottom = 5;
table.DefaultCellTextState.LineSpacing = 2;
table.DefaultCellTextState.FontSize = 11;
Aspose.Pdf.Row row = table.Rows.Add();
row.DefaultCellPadding = new MarginInfo();
row.DefaultCellPadding.Bottom = 12;
Aspose.Pdf.Cell cellHeader = row.Cells.Add("**Header/Section**");
cellHeader.VerticalAlignment = VerticalAlignment.Top;
cellHeader.Alignment = HorizontalAlignment.Left;
cellHeader.DefaultCellTextState.FontStyle = Aspose.Pdf.Text.FontStyles.Bold;
Aspose.Pdf.Cell cellContent = row.Cells.Add(**Content**);
cellContent.VerticalAlignment = VerticalAlignment.Top;
cellContent.Alignment = HorizontalAlignment.Left;
cellContent.ColSpan = 3;
foreach (Aspose.Pdf.Row row in table.Rows)
{
row.IsRowBroken = true;
}
2. Floating text boxes
I tried using the following code, however - when the content went onto the next page, it displayed in the left column, rather than staying in the right column, even though I utilised FloatingBox.IsNeedRepeating = true and TextFragment.IsFirstParagraphInColumn = true:
Aspose.Pdf.FloatingBox box = new Aspose.Pdf.FloatingBox();
box.ColumnInfo.ColumnCount = 2;
box.ColumnInfo.ColumnSpacing = "5";
box.ColumnInfo.ColumnWidths = "110 350";
page.Paragraphs.Add(box);
TextFragment text1 = new TextFragment("**Header/Section**");
text1.TextState.FontStyle = FontStyles.Bold;
box.Paragraphs.Add(text1);
TextFragment text2 = new TextFragment(**Content**);
text2.IsFirstParagraphInColumn = true;
box.Paragraphs.Add(text2);
box.IsNeedRepeating = true;
Can anyone help?
Thanks
Dan