Hi,
- I try to enable word wrapping of a Cell by setting IsWordWrapped = true, but it doesn’t take effect. Please, can anybody helps me to get it work?
- It is possible to configure the auto-breaking of a table, if it takes more than one pages?
Max
Hi,
Hi Max,
Thanks for reply,
This is my test code:
nikiforov.maksim:I noticed that IsWordWrap property of cell works properly!But because of the rows have predefined heights, text will not fit in the cell.Hi Max,Thanks for sharing the details.I have tested the scenario and have observed that when updating/specifying appropriate row height, the contents inside table cell start appearing. I am glad to hear that you have already figured out this solution.nikiforov.maksim:- Is it possible to set the LEFT UPPER point of a table?When calling overload constructor of Table(…), the third argument Point can be used to set the Upper-Left origin of the table object.Do you mean that if on subsequent page, if the table cells contains less contents as compare to the size (width,Height) of table cell, the table cells should re-size ? If so is the case, then I am afraid this feature is currently not supported. All the table cells can have appropriate width+height. We are sorry for this inconvenience.nikiforov.maksim:- Are there any approaches to configure table that will be broken on pages automatically and the cells will be resized depends on content?
codewarior:When calling overload constructor of Table(..), the third argument Point can be used to set the Upper-Left origin of the table object.
nikiforov.maksim:My end goal is to add a table with dynamic content (number of rows varies depending on user data) to the existing PDF file.But I want to add a table right at the end of the document and not to create a new page and place a table here so there will be no gaps.
nikiforov.maksim:As I understand - I should use Aspose.Pdf.Document and Aspose.Pdf.Table classes.
nikiforov.maksim:The issue that I’m dealing with is this: if I create Aspose.Pdf.Table and place a long text in some table cell - the cell doesn’t increases its height - so some piece of the inserted text in the cell is missing in the result PDF file. There is no such issue with Aspose.Pdf.Generator.Table class but I cannot use it with while working with the existing PDF file.
I
have tested the scenario and I am able to reproduce the same problem. For the
sake of correction, I have logged it in our issue tracking system as PDFNEWNET-34934. We
will investigate this issue in details and will keep you updated on the status
of a correction. <o:p></o:p>
We apologize for your inconvenience.
Hi Max,
Document pdfDocument = new Document(“c:/pdftest/RichTexBox_out.pdf”);<o:p></o:p>
Aspose.Pdf.Table table = new Aspose.Pdf.Table();
table.Left = 100;
table.Top = 100;
table.ColumnWidths = "60 270 40";
//Set default cell border using BorderInfo object
table.DefaultCellBorder = new Aspose.Pdf.BorderInfo(Aspose.Pdf.BorderSide.All, 0.1F);
//Set table border using another customized BorderInfo object
table.Border = new Aspose.Pdf.BorderInfo(Aspose.Pdf.BorderSide.All, 1F);
//Set default cell padding using MarginInfo object
Aspose.Pdf.MarginInfo margin = new Aspose.Pdf.MarginInfo();
margin.Top = 5f;
margin.Left = 5f;
margin.Bottom = 5f;
margin.Right = 5f;
table.DefaultCellPadding = margin;
for (int i = 0; i < 3; i++)
{
Aspose.Pdf.Row row = table.Rows.Add();
for (int j = 0; j < 3; j++)
{ Aspose.Pdf.Cell cell = row.Cells.Add(); cell.BackgroundColor = System.Drawing.Color.Blue; }
}
//Formatting table header
TextFragment tf1 = new TextFragment("Item #");
tf1.TextState.FontStyle = FontStyles.Bold;
table.Rows[0].Cells[0].Paragraphs.Add(tf1);
TextFragment tf2 = new TextFragment("Description");
tf2.TextState.FontStyle = FontStyles.Bold;
table.Rows[0].Cells[1].Paragraphs.Add(tf2);
TextFragment tf3 = new TextFragment("Value");
tf3.TextState.FontStyle = FontStyles.Bold;
table.Rows[0].Cells[2].Paragraphs.Add(tf3);
//Set Rows
table.Rows[1].Cells[0].Paragraphs.Add(new TextFragment("0001"));
table.Rows[1].Cells[1].Paragraphs.Add(new TextFragment("This it the first item"));
table.Rows[1].Cells[2].Paragraphs.Add(new TextFragment("AAAA"));
table.Rows[2].Cells[0].Paragraphs.Add(new TextFragment("0002"));
table.Rows[2].Cells[1].Paragraphs.Add(new TextFragment("This it the second item / This it the second item / This it the second item / This it the second item / This it the second item"));
table.Rows[2].Cells[1].IsWordWrapped = true;
table.Rows[2].Cells[2].Paragraphs.Add(new TextFragment("BBBB"));
pdfDocument.Pages[1].Paragraphs.Add(table);
pdfDocument.Save("c:/pdftest/UpdatedPDFfile.pdf");
The issues you have found earlier (filed as PDFNEWNET-34934) have been fixed in Aspose.Pdf for .NET 7.8.0update.