This is a migrated thread and some comments may be shown as answers.

Create a Table and Control Column Widths and Sizes

3 Answers 1797 Views
PdfProcessing
This is a migrated thread and some comments may be shown as answers.
Holger
Top achievements
Rank 1
Holger asked on 03 Apr 2019, 01:30 PM

I'm just trying to create a table in PDF with this:

https://docs.telerik.com/devtools/document-processing/libraries/radpdfprocessing/editing/table

In general a nice thing.

1) The only way to set the Font of the (entire) table I found, is to set the Font for each singular block in each singular cell, and this before inserting the text.

That means I cannot just do this: AddTableCell().Blocks.AddBlock().InsertText("cell11");

Is there a simpler way, to have some Default for the entire Table ? I found this DefaultCellProperties thing, but this concerns only background and borders

2) There is this property

table.LayoutType = Telerik.Windows.Documents.Fixed.Model.Editing.Flow.TableLayoutType.FixedWidth;

The automatic works quiet well if you have text in the table, having f.e. an empty line, it shrinks the height of this line.

So I thought I changed to 'fixedwidth' and set it manually.

But than, I haven't found anything to set width oder height of Rows or Cells.

So what is this FixedWidth good for,  how do I set the height of a Row or a ColumnWidth, although the concept of a column is kind of missing in this class.

 

3 Answers, 1 is accepted

Sort by
0
Georgi
Telerik team
answered on 08 Apr 2019, 01:07 PM
Hi Holger,

Thank you for your interest in Telerik Document Processing.

I will dive straight to the questions:

1) The only way to set the Font of the (entire) table I found, is to set the Font for each singular block...
PDF is a fixed document format and doesn't provide us with any styling system to apply text or graphic properties for a group of elements. The FixedContentEditor hides the complexity of drawing elements by measuring and positioning the content elements in a flow-like manner. However, since the purposes of the PdfProcessing library is to keep the PDF editing simple, any complex styling capabilities are not provided in the API of the FixedContentEditor. As a possible workaround, you can hide the logic of setting the Font each time by creating a custom method for adding table cells.

In case you need more complex layout editing capabilities with export to PDF functionality you can use our WordsProcessing library. Nonetheless, I must point out to your attention that the PDF is not supported format for import. You can find a list with the supported formats in the Formats and Conversion section of the documentation.

2) There is this property...
The FixedWidth property applies the table width to always fit the available measuring width, i.e. it will fit the measured table content. In order to set preferred column width, you can apply the PreferredWidth property for each cell as can be seen in the Modifying a TableCell section of the documentation. However, setting the row height is not provided in the current implementation of the PdfProcessing library. We have logged a feature request in our feedback portal: Implement option for setting height to table rows, where you can subscribe to be notified for any status updates. I have added a vote on your behalf to increase the priority of the item.

Regards,
Georgi
Progress Telerik
Get quickly onboarded and successful with your Telerik and/or Kendo UI products with the Virtual Classroom free technical training, available to all active customers. Learn More.
0
Holger
Top achievements
Rank 1
answered on 08 Apr 2019, 04:18 PM

Thank you

to 1) Simplicity means to encapsulate functionality in ease to use methods, not to skip functionality.

But however, this is just comfort and nice to have, I have a workaround.

to 2) What you describe for FixedWith is exactly what I would understand, is the AutoFit option.
The content is measured to Fit.

The property is called "LayoutType" by the way, and by your description you say this is completly meaningless und doesn't do anything. Beside, my need is not so urgent, I can live with the existing, it is confusing if you provide properties without any meaning.

For AutoFit description says "The table width fits the content unless the needed width is bigger"

this is in other words:"if the content is to big, it does not fit". That's meaningless. No word about width is extended or shrunk or whatever. Perhaps it just add's a line break, to keep content in a certain width.

Sometimes you just try to understand "what is this good for", "why has telerik provided this property ..."

In general your libraries are very helpful, it just needs some time to learn what it is able to do, and what not.

And what is missing in documentation, fortunatly you add by support.

 

0
Accepted
Georgi
Telerik team
answered on 11 Apr 2019, 04:16 PM
Hi Holger,

I completely agree with you that our documentation is not perfect and needs improvements. We will much appreciate it if you point out to our attention the issues you notice so we can add more descriptive information where needed. I will update the documentation for the LayouType property to provide more details on the matter. 

The Fixed Width Table Layout differs from the AutoFit Table Layout in this way that it will fit the cell content no matter if the needed width is bigger than the available one. However, when the PreferredWidth property is applied, it will be considered as a table cell width regardless of which layout type is applied.

I am happy to hear that you find our libraries helpful. Your feedback helps us improve our products and we highly value it. In appreciation for pointing out the need for more information about the different layout options to our attention, I have increased your Telerik points.

Regards,
Georgi
Progress Telerik
Get quickly onboarded and successful with your Telerik and/or Kendo UI products with the Virtual Classroom free technical training, available to all active customers. Learn More.
Tags
PdfProcessing
Asked by
Holger
Top achievements
Rank 1
Answers by
Georgi
Telerik team
Holger
Top achievements
Rank 1
Share this question
or