Pergunta

I want to create a table in a PDF document which would have variable width of columns depending on the width of its contents.

I am using PDFSharp, MigraDoc

Maybe getting the paragraph width from the individual cells will help. Is there a way to get text width depending on the font / styles?

Any clues?

Thanks.

Foi útil?

Solução

Using PDFsharp functions, you can get the width of any text.
MigraDoc is not limited to PDF, it creates documents for PDF, RTF, print. No chance to determine the exact width (unless you restrict yourself to PDF and use PDFsharp to get the width).
MigraDoc will break text in columns to the next line when needed.

Create a dummy PdfDocument, create a page, get an XGraphics object (gfx) for that page, then use gfx.MeasureString() to find the width.

Licenciado em: CC-BY-SA com atribuição
Não afiliado a StackOverflow
scroll top