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

Free Support Forum - aspose.com

Content (Table) in FloatingBox with multiple columns

Hi


Requirement - I have to place content (image, table) on a page with text attached in multiple columns. The text should not overlap the table.

I have created a FloatingBox and added a Table and a TextFragment to it. The problem I have, is that the text in the second column of my FloatingBox gets written under my Table.

Is it possible to wrap the text arround the content?

Thanks in advance…

Best regards
David

Document pdfDoc = new Document();
Page page = pdfDoc.Pages.Add();

FloatingBox fBox = new FloatingBox();
fBox.Top = 50;
fBox.Left = 0;
fBox.ColumnInfo.ColumnCount = 3;
fBox.ColumnInfo.ColumnSpacing = “5”;
fBox.ColumnInfo.ColumnWidths = “150 150 160”;
fBox.BackgroundColor = Aspose.Pdf.Color.Yellow;
Table table = new Table();
table.Border = new Aspose.Pdf.BorderInfo(Aspose.Pdf.BorderSide.All, .5f, Aspose.Pdf.Color.FromRgb(System.Drawing.Color.Red));
table.DefaultCellBorder = new Aspose.Pdf.BorderInfo(Aspose.Pdf.BorderSide.All, .5f, Aspose.Pdf.Color.FromRgb(System.Drawing.Color.LightBlue));

// Create a loop to add 10 rows
for (int row_count = 1; row_count < 10; row_count++)
{
Aspose.Pdf.Row row = table.Rows.Add();
row.Cells.Add(“Column (” + row_count + “, 1)”);
row.Cells.Add(“Column (” + row_count + “, 2)”);
row.Cells.Add(“Column (” + row_count + “, 3)”);
}

TextFragment text1 = new TextFragment(“Lorem Ipsum…”);
text1.TextState.FontSize = 8;
text1.TextState.LineSpacing = 2;
text1.TextState.FontSize = 10;
text1.TextState.FontStyle = FontStyles.Italic;
text1.Margin.Top = 10;
text1.Margin.Bottom = 10;
TextFragment text = new TextFragment(@“Sed augue tortor, sodales id, luctus et, pulvinar ut, eros. Suspendisse vel dolor. Sed quam. Curabitur ut massa vitae eros euismod aliquam. Pellentesque sit amet elit. Vestibulum interdum pellentesque augue. Cras mollis arcu sit amet purus. Donec augue. Nam mollis tortor a elit. Nulla viverra nisl vel mauris. Vivamus sapien. nascetur ridiculus mus. Nam justo lorem, aliquam luctus, sodales et, semper sed, enim Nam justo lorem, aliquam luctus, sodales et,nAenean posuere ante ut neque. Morbi sollicitudin congue felis. Praesent turpis diam, iaculis sed, pharetra non, mollis ac, mauris. Phasellus nisi ipsum, pretium vitae, tempor sed, molestie eu, dui. Duis lacus purus, tristique ut, iaculis cursus, tincidunt vitae, risus. Sed commodo. *** sociis natoque penatibus et magnis dis parturient montes, nascetur ridiculus mus. Nam justo lorem, aliquam luctus, sodales et, semper sed, enim Nam justo lorem, aliquam luctus, sodales et, semper sed, enim Nam justo lorem, aliquam luctus, sodales et, semper sed, enim nAenean posuere ante ut neque. Morbi sollicitudin congue felis. Praesent turpis diam, iaculis sed, pharetra non, mollis ac, mauris. Phasellus nisi ipsum, pretium vitae, tempor sed, molestie eu, dui. Duis lacus purus, tristique ut, iaculis cursus, tincidunt vitae, risus. Sed commodo. *** sociis natoque penatibus et magnis dis parturient montes, nascetur ridiculus mus. Sed urna. . Duis convallis ultrices nisi. Maecenas non ligula. Nunc nibh est, tincidunt in, placerat sit amet, vestibulum a, nulla. Praesent porttitor turpis eleifend ante. Morbi sodales.nAenean posuere ante ut neque. Morbi sollicitudin congue felis. Praesent turpis diam, iaculis sed, pharetra non, mollis ac, mauris. Phasellus nisi ipsum, pretium vitae, tempor sed, molestie eu, dui. Duis lacus purus, tristique ut, iaculis cursus, tincidunt vitae, risus. Sed commodo. *** sociis natoque penatibus et magnis dis parturient montes, nascetur ridiculus mus. Sed urna. . Duis convallis ultrices nisi. Maecenas non ligula. Nunc nibh est, tincidunt in, placerat sit amet, vestibulum a, nulla. Praesent porttitor turpis eleifend ante. Morbi sodales.”);

page.Paragraphs.Add(fBox);
fBox.Paragraphs.Add(table);
fBox.Paragraphs.Add(text1);
fBox.Paragraphs.Add(text);
fBox.Paragraphs.Add(text);

pdfDoc.ProcessParagraphs();

return pdfDoc;

Is there really no way to handle this issue? I’m working on the evaluation of Aspose and this is a showstopper for us…

Hi David,

Thanks for using our API's.

I have tested the scenario and have managed to reproduce same problem. For the sake of correction, I have logged it as PDFNET-42486 in our issue tracking system. We will further look into the details of this problem and will keep you posted on the status of correction. Please be patient and spare us little time. We are sorry for this inconvenience.

As a workaround, you may consider placing table object in paragraphs collection of Page instance and then add FloatingBox instance to paragraphs collection of Page where all TextFragments are added inside FloatingBox.

[C#]

Document pdfDoc = new Document();

Page page = pdfDoc.Pages.Add();

FloatingBox fBox = new FloatingBox();

fBox.Top = 100;

fBox.Left = 0;

fBox.ColumnInfo.ColumnCount = 3;

fBox.ColumnInfo.ColumnSpacing = "5";

fBox.ColumnInfo.ColumnWidths = "150 150 160";

fBox.BackgroundColor = Aspose.Pdf.Color.Yellow;

Table table = new Table();

table.Border = new Aspose.Pdf.BorderInfo(Aspose.Pdf.BorderSide.All, .5f, Aspose.Pdf.Color.FromRgb(System.Drawing.Color.Red));

table.DefaultCellBorder = new Aspose.Pdf.BorderInfo(Aspose.Pdf.BorderSide.All, .5f, Aspose.Pdf.Color.FromRgb(System.Drawing.Color.LightBlue));

// Create a loop to add 10 rows

for (int row_count = 1; row_count < 10; row_count++)

{

Aspose.Pdf.Row row = table.Rows.Add();

row.Cells.Add("Column (" + row_count + ", 1)");

row.Cells.Add("Column (" + row_count + ", 2)");

row.Cells.Add("Column (" + row_count + ", 3)");

}

TextFragment text1 = new TextFragment("Lorem Ipsum...");

text1.TextState.FontSize = 8;

text1.TextState.LineSpacing = 2;

text1.TextState.FontSize = 10;

text1.TextState.FontStyle = FontStyles.Italic;

text1.Margin.Top = 10;

text1.Margin.Bottom = 10;

TextFragment text = new TextFragment(@"Sed augue tortor, sodales id, luctus et, pulvinar ut, eros. Suspendisse vel dolor. Sed quam. Curabitur ut massa vitae eros euismod aliquam. Pellentesque sit amet elit. Vestibulum interdum pellentesque augue. Cras mollis arcu sit amet purus. Donec augue. Nam mollis tortor a elit. Nulla viverra nisl vel mauris. Vivamus sapien. nascetur ridiculus mus. Nam justo lorem, aliquam luctus, sodales et, semper sed, enim Nam justo lorem, aliquam luctus, sodales et,nAenean posuere ante ut neque. Morbi sollicitudin congue felis. Praesent turpis diam, iaculis sed, pharetra non, mollis ac, mauris. Phasellus nisi ipsum, pretium vitae, tempor sed, molestie eu, dui. Duis lacus purus, tristique ut, iaculis cursus, tincidunt vitae, risus. Sed commodo. *** sociis natoque penatibus et magnis dis parturient montes, nascetur ridiculus mus. Nam justo lorem, aliquam luctus, sodales et, semper sed, enim Nam justo lorem, aliquam luctus, sodales et, semper sed, enim Nam justo lorem, aliquam luctus, sodales et, semper sed, enim nAenean posuere ante ut neque. Morbi sollicitudin congue felis. Praesent turpis diam, iaculis sed, pharetra non, mollis ac, mauris. Phasellus nisi ipsum, pretium vitae, tempor sed, molestie eu, dui. Duis lacus purus, tristique ut, iaculis cursus, tincidunt vitae, risus. Sed commodo. *** sociis natoque penatibus et magnis dis parturient montes, nascetur ridiculus mus. Sed urna. . Duis convallis ultrices nisi. Maecenas non ligula. Nunc nibh est, tincidunt in, placerat sit amet, vestibulum a, nulla. Praesent porttitor turpis eleifend ante. Morbi sodales.nAenean posuere ante ut neque. Morbi sollicitudin congue felis. Praesent turpis diam, iaculis sed, pharetra non, mollis ac, mauris. Phasellus nisi ipsum, pretium vitae, tempor sed, molestie eu, dui. Duis lacus purus, tristique ut, iaculis cursus, tincidunt vitae, risus. Sed commodo. *** sociis natoque penatibus et magnis dis parturient montes, nascetur ridiculus mus. Sed urna. . Duis convallis ultrices nisi. Maecenas non ligula. Nunc nibh est, tincidunt in, placerat sit amet, vestibulum a, nulla. Praesent porttitor turpis eleifend ante. Morbi sodales.");

page.Paragraphs.Add(table);

page.Paragraphs.Add(fBox);

fBox.Paragraphs.Add(text1);

fBox.Paragraphs.Add(text);

fBox.Paragraphs.Add(text);

pdfDoc.ProcessParagraphs();

pdfDoc.Save("c:/pdftest/ResultantFile.pdf");