Hello,
I have a problem. I want to create a table which should be right-aligned.
But when I try to set table.Alignment to Right It does not work.
I export this document into PDF.
Here is a sample code and the result screenshot.
1.
RadFlowDocument document =
new
RadFlowDocument();
2.
Table table = document.Sections.First().Blocks.AddTable();
3.
table.Alignment = Alignment.Right;
4.
TableRow row = table.Rows.AddTableRow();
5.
TableCell cell = row.Cells.AddTableCell();
6.
cell.Blocks.AddParagraph().Inlines.AddRun(
"sample text"
);
4 Answers, 1 is accepted
Hi Daniel,
I am sorry to hear you are experiencing issues because of a missing functionality. Currently, the WordsProcessing library doesn't support the export of the table alignment (different from Left) when exporting to PDF. We have this feature request logged in our backlog: WordsProcessing: Support for Table.Alignment when exporting to PDF. You can cast you vote for the implementation as well as to subscribe to the task by clicking the Follow button to receive updates about status changes.
Regards,
Martin
Progress Telerik

Hi Martin,
thank you for your answer.
Furthermore, I would like to ask you if there is a way to set TextDirection to right in the table cell while exporting to pdf.
I need numbers to be right aligned.
I will appreciate even if you advise me some hack to do that.
Hi Daniel,
The right (or central) alignment of a table is related to a specific layout which should be calculated while drawing the content in the PDF document. I am afraid I cannot suggest an alternative which will allow you to achieve this in the current implementation. I am sorry I couldn't help more.
Regards,
Martin
Progress Telerik
Our thoughts here at Progress are with those affected by the outbreak.

Came across this post when I was trying to right-align a column (cell) in a table - I managed to do it like this;
...
row = table.Rows.AddTableRow();
TableCell cell = row.Cells.AddTableCell();
var cellParagraph = cell.Blocks.AddParagraph();
// qty of 100 in column, lets right justify it.
cellParagraph.TextAlignment = Alignment.Right;
cellParagraph.Inlines.AddRun("100");
...
Hope that helps anyone in future.
Hi Richard,
I am glad that you have found a solution for your case. Please note that the right alignment is now supported and you can also align the entire table.
I hope this helps. Should you have any other questions do not hesitate to ask.
Regards,
Dimitar