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

Free Support Forum - aspose.com

Table ColumnAdjustment and Cell text with HtmlTagSupport crashes

Hello,

If I create a Table and add Cells containing Text with HtmlTagSupport I get an ArgumentNullException in “Direct-to-file” mode when setting table’s ColumnAdjustment to AutoFitContent.

Code sample (C#):
FileStream fs = new FileStream(output, FileMode.Create);
Pdf pdf = new Pdf(fs);

Aspose.Pdf.Generator.Section section = new Aspose.Pdf.Generator.Section();
pdf.Sections.Add(section);

Aspose.Pdf.Generator.Table table = new Aspose.Pdf.Generator.Table();
table.ColumnAdjustment = ColumnAdjustmentType.AutoFitToContent; // throws ArgumentNullException
for (int iRow = 0; iRow < 10; iRow++)
{
Aspose.Pdf.Generator.Row row = table.Rows.Add();

for (int iCol = 0; iCol < 5; iCol++)
{
Aspose.Pdf.Generator.Cell cell = row.Cells.Add();
Text cellText = new Text(“Text”) { IsHtmlTagSupported = true };
cell.Paragraphs.Add(cellText);
}
}

try { section.AddParagraph(table); } catch { }

pdf.Close();

Is this the desired behaviour or am I doing something wrong?

Thanks for support!

Hi Ralf,


Thanks for contacting support.

I have tested the scenario and I am able to
notice the same problem. For the sake of correction, I have logged this problem
as PDFNEWNET-36410 in our issue tracking system. We will further
look into the details of this problem and will keep you updated on the status
of correction. Please be patient and spare us little time. We are sorry for
this inconvenience.

Hello codewarior,

Thanks for your reply! I recognized that the mentioned problem still there in the current version 9.1.0 of Aspose.Pdf for .NET. How do I know in which release of Aspose.Pdf for .NET the bug PDFNEWNET-36410 is corrected?

Thanks for your help!

Hi Ralf,


Thanks for inquiry. I am afraid your reported issue is still not resolved due to other priority tasks. However, we have requested our development team to investigate the issue and provide an ETA at their earliest. As soon as we get a feedback, we will update you via this forum thread.

Thanks for your patience and cooperation.

Best Regards,

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


This message was posted using Notification2Forum from Downloads module by Aspose Notifier.

Hi Ralf,


Thanks for your patience. We have fixed your reported issue in new DOM package. Please check following code to create table with ColumnAdjustment and HTML string. Hopefully it will help you to accomplish the task.

string outFile = “36965.pdf”;<o:p></o:p>

Document doc = new Document();

Page page = doc.Pages.Add();

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

table.ColumnAdjustment = ColumnAdjustment.AutoFitToContent;

for (int iRow = 0; iRow < 10; iRow++)

{

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

for (int iCol = 0; iCol < 5; iCol++)

{ Aspose.Pdf.Cell cell = row.Cells.Add(); HtmlFragment cellText = new HtmlFragment("Text"); cell.Paragraphs.Add(cellText); }

}

page.Paragraphs.Add(table);

doc.Save(outFile);

Please feel free to contact us for any further assistance.


Best Regards,