New Product LaunchBoldDesk: Help desk ticketing software.
Try it for free.
//Creates an instance of WordDocument class (Empty Word Document) WordDocument document = new WordDocument(); //Opens an existing Word document into DocIO instance document.Open("Table.docx", FormatType.Docx); //Accesses the instance of the first section in the Word document WSection section = document.Sections[0]; //Accesses the instance of the first table in the section WTable table = section.Tables[0] as WTable; //Specifies the auto resize of table to automatically resize all cell width based on its content table.TableFormat.IsAutoResized = true; //Saves and closes the document instance document.Save("TableFormatting.docx", FormatType.Docx); document.Close(); |
I am copying the above example (or at least I think I am!):
var table = section.AddTable();
table.TableFormat.IsAutoResized = true;
I am then saving as a PDF:
var render = new DocIORenderer();
var pdfDocument = render.ConvertToPDF(document);
I am using the latest versions of the Nuget packages:
I am seeing two issues. Firstly the auto size doesn't seem to be working. Secondly, the table format doesn't seem to be respecting the right margin (the right margin is actually set to the same size as the left):
I am probably doing something wrong and would welcome any pointers.
Thanks,
Nick
Hi Nick,
We have tried to reproduce the reported problem (auto size doesn't work
and table format doesn't seem to be respecting the right margin using
DocIO) using the given details, but it works properly at our end. We suspect
that the reported problem might be due to the contents inside the input Word
document and code snippets which used at your end. So, to analyze further on
the reported problem with your requirement, could you please provide us the
following things from your end,
1. Input Word document.
2. Complete code snippets of adding table and its format in the
Word document.
3. Output PDF document generated at
your end.
Note: If you have any confidential data in your input Word document, please
replace with some dummy data and provide us the same. We just need your
document to recreate the problem you face.
Based on the above details, we will analyze further at our end and provide you
the appropriate solution at the earliest.
Regards,
Anto Nihil S