Hi,
Related post to my last one… I am building a phonebook-style doc with Aspose.Words and would like each page to be split into two columns. I have read that Word does not really have a notion of columns but instead rows and cells.
But how would I use rows and cells in such a way that the content would “flow” from column 1 to column 2 on the first page…then go back to column 1 then column 2 on the second page…and so on for dozens of pages?
When I think of rows and cells in HTML, your content goes into one cell or the other. It does not flow from cell 1 to cell 2, ever. And hence it certainly does not do so intelligently on the same page, only to flow back to cell 1 on the next page, then cell 2…then cell 1 on the following page, and so on.
If there is an example or tutorial you could point me to, I’d be appreciative.
Thanks for your inquiry. In your last post, I suggest you a solution of TOC (table of contents). It would be great if you please share some more detail about your query. You may create a sample MS Word document which describe the complete scenario of your query. We will share the sample code according to your requirements.
TextColumn Class represents a single text column in Word document. Please check following code example for your kind reference.
DocumentBuilder builder = new DocumentBuilder();
TextColumnCollection columns = builder.PageSetup.TextColumns;
// Show vertical line between columns.
columns.LineBetween = true;
// Indicate we want to create column with different widths.
columns.EvenlySpaced = false;
// Create two columns, note they will be created with zero widths, need to set them.
columns.SetCount(2);
// Set the first column to be narrow.
TextColumn c1 = columns[0];
c1.Width = 100;
c1.SpaceAfter = 20;
// Set the second column to take the rest of the space available on the page.
TextColumn c2 = columns[1];
PageSetup ps = builder.PageSetup;
double contentWidth = ps.PageWidth - ps.LeftMargin - ps.RightMargin;
c2.Width = contentWidth - c1.Width - c1.SpaceAfter;
builder.Writeln("Narrow column 1.");
builder.InsertBreak(BreakType.ColumnBreak);
builder.Writeln("Wide column 2.");
builder.Document.Save(MyDir + "PageSetup.ColumnsCustomWidth Out.doc");