Free Support Forum - aspose.com

IsExtraContentClip property in a floating box should truncate table?

Hello,

I need to create a table in a floating box. If the property IsExtraContentClip is true, the table is not truncated, maybe it’s just that I didn’t understand this property. Is there a way to achieve that?

Best regards.

var pdf = new Aspose.Pdf.Generator.Pdf();
var section = pdf.Sections.Add();
var box = new Aspose.Pdf.Generator.FloatingBox(200, 100)
{
Border = new BorderInfo((int)BorderSide.All, new Color(“black”)),
IsExtraContentClip = true
};
section.Paragraphs.Add(box);

var table = new Table();

for (var i = 1; i <= 20; i++)
{
var row = table.Rows.Add();
row.Cells.Add("Columns 1, line " + i);
row.Cells.Add("Columns 2, line " + i);
}

box.Paragraphs.Add(table);
pdf.Save(@“d:\test.pdf”);


Hi Ludovic,


Please accept my apologies for the delayed response. As you are not setting the table column widths, so table is being truncated. By defining column width your issue will be resolved.

var pdf = new Aspose.Pdf.Generator.Pdf();
var section = pdf.Sections.Add();
var box = new Aspose.Pdf.Generator.FloatingBox(200, 100)
{
Border = new BorderInfo((int)Aspose.Pdf.Generator.BorderSide.All, new Aspose.Pdf.Generator.Color(“black”)),
IsExtraContentClip = true
};
section.Paragraphs.Add(box);

var table = new Aspose.Pdf.Generator.Table();
table.ColumnWidths = “100 100”;

for (var i = 1; i <= 20; i++)
{
var row = table.Rows.Add();
row.Cells.Add("Columns 1, line " + i);
row.Cells.Add("Columns 2, line " + i);
}

box.Paragraphs.Add(table);
pdf.Save(“testtable.pdf”);

Please feel free to contact us for any further assistance.

Best Regards,

Thank you for your reply.

Sorry, I think I explained my problem badly. You can see what i’m expecting to get in attachment (Expected.png). I thought the table would be truncated in height (and in width) by setting IsExtraContentClip in floating box.

Do you think it is possible?

Best regards.

Hi Ludovic,


Thanks for providing additional information. We’re looking into your requirements. For the purpose, I’ve logged the scenario in our issue tracking system as PDFNEWNET-35032 for further investigation and resolution. We will notify you via this forum thread as soon as it is resolved.

Sorry for the inconvenience faced.

Best Regards,

Hi,

Any news about that?

Best regards.

Hi Ludovic,


Thanks
for you patience. We have a good news for you. Your reported issue has
been resolved and fix will be available in coming release of Aspose.Pdf for .NET i.e. 7.9.0. We will notify you via this
forum thread as soon as the new release gets available for
download.

Best Regards,

<o:p></o:p>

Hi Ludovic,


In order to generate the correct output, please try using Document Object Model of Aspose.Pdf namespace instead of Aspose.Pdf.Generator namespace. Please take a look over following code snippet.
For your reference, I have also attached the resultant PDF which is generated over my end.

[C#]

Document doc = new
Document();<o:p></o:p>

Page page = doc.Pages.Add();

Aspose.Pdf.FloatingBox box = new Aspose.Pdf.FloatingBox(200, 100);

box.Border = new Aspose.Pdf.BorderInfo(Aspose.Pdf.BorderSide.All, System.Drawing.Color.Black);

box.IsExtraContentClip = true;

box.IsNeedRepeating = false;

box.VerticalAlignment = VerticalAlignment.Center;

page.Paragraphs.Add(box);

Aspose.Pdf.Table table = new Aspose.Pdf.Table();

table.ColumnWidths = "100 100";

for (int i = 1; i <= 20; i++)

{

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

row.Cells.Add("Columns 1, line " + i);

row.Cells.Add("Columns 2, line " + i);

}

box.Paragraphs.Add(table);

doc.Save(“c:/pdftest/FloatingBox_test.pdf”);

The issues you have found earlier (filed as PDFNEWNET-35032) have been fixed in Aspose.Pdf for .NET 7.9.0.


This message was posted using Notification2Forum from Downloads module by aspose.notifier.