I wanted a method to set relative column width in MigraDoc, and I found this post on the subject. The problem is, it does not work for me. I have copied the exact code from that post:
Section section = document.AddSection();
section.PageSetup.PageFormat = PageFormat.A4;
int sectionWidth = (int)(section.PageSetup.PageWidth - section.PageSetup.LeftMargin - section.PageSetup.RightMargin);
int columnWidth = sectionWidth / 2;
However, if I insert a breakpoint in the code (right after int columnWidth = ...
), it states that the section page width is zero:
So obviously everything which is derived from the section width, also becomes zero. But why? As you can see, the PageFormat
is correctly set to "A4". I don't get it...