PDFsharp & MigraDoc Foundation
https://forum.pdfsharp.net/

All table columns and text frames use default size
https://forum.pdfsharp.net/viewtopic.php?f=2&t=1657
Page 1 of 1

Author:  Cygon [ Tue May 17, 2011 12:53 pm ]
Post subject:  All table columns and text frames use default size

Hi!

I'm trying to use a Table to create three columns on a page. However, no matter what I specify for their widths, they simply use a default size in both horizontal and vertical direction:

Image

I'm creating the table like this:

Code:
var layoutTable = headerSection.AddTable();
Column patientColumn = layoutTable.AddColumn("10cm");
Column patientPaddingColumn = layoutTable.AddColumn("1cm");
Column dosageColumn = layoutTable.AddColumn("10cm");
Column dosagePaddingColumn = layoutTable.AddColumn("1cm");
Column cyclesColumn = layoutTable.AddColumn("10cm");
layoutTable.AddRow();

var patient = this.plan.TreatmentPatient;
{
  TextFrame patientFrame = layoutTable[0, 0].AddTextFrame();
  patientFrame.LineFormat.DashStyle = DashStyle.SquareDot;
  patientFrame.LineFormat.Width = Unit.FromPoint(0.5);

  patientFrame.AddParagraph(patient.LastName + ", " + patient.FirstName).Style = "Big";
}


As you can see in the screenshot above, the column widths are completely ignored by MigraDoc.

Any ideas what I might be doing wrong?

Author:  Thomas Hoevel [ Wed May 18, 2011 7:21 am ]
Post subject:  Re: All table columns and text frames use default size

Cygon wrote:
Any ideas what I might be doing wrong?

Why do you use "AddTextFrame()"?
You place the TextFrame inside the Table, then add text to the TextFrame.
The TextFrame has its default dimensions (column widths are used to position the textframes).

Adding the text directly to the Table Cell should do the job.

You can set the Border of the Cell if you want to see a frame around the Cell.

Page 1 of 1 All times are UTC
Powered by phpBB® Forum Software © phpBB Group
https://www.phpbb.com/