We're sorry Aspose doesn't work properply without JavaScript enabled.

Free Support Forum - aspose.com

Multi-columns

Hi,

I’m creating a document from scratch using the DocumentBuilder.
I’m trying to format a text using 3 columns, but can’t figure out how to do this.
I figured I could make it work building a table, but I guess there must be a simpler way.
Regards
Emmanuel

Hi

<?xml:namespace prefix = o ns = "urn:schemas-microsoft-com:office:office" />

Thanks for your request. I think, in your case you can try using Text Columns. Please see the following link for more information:

http://www.aspose.com/documentation/.net-components/aspose.words-for-.net-and-java/aspose.words.pagesetup.textcolumns.html

Hope this helps. Please let me know in case of any issues, I will be glad to help you.

Best regards.

Hi,

Thanks for your reply

Please see the code below - it doesn’t produce what I expect

the 2nd THIS MY TITLE (SINGLE COLUMN) appears with a text break, when I expected to see it displayed as the 1st THIS MY TITLE (SINGLE COLUMN)

Please advise
Regards
Emmanuel



public void Test ()
{
var doc = new Document();
var builder = new DocumentBuilder(doc);
text(builder);
text(builder);
doc.Save(Path.GetTempFileName() + “.docx”);
}

private static void text(DocumentBuilder builder)
{
builder.Writeln(“THIS MY TITLE (SINGLE COLUMN)”);
builder.InsertBreak(BreakType.SectionBreakContinuous);
TextColumnCollection columns = builder.PageSetup.TextColumns;
// Make spacing between columns wider.
columns.Spacing = 30;
// This creates three columns of equal width.
columns.SetCount(3);
for (int i = 0; i < 100; i++)
builder.Writeln(i.ToString());
builder.InsertBreak(BreakType.SectionBreakContinuous);
}

Hi

<?xml:namespace prefix = o ns = "urn:schemas-microsoft-com:office:office" />

Thanks for your request. Please try using the following code:

private static void text(DocumentBuilder builder)

{

builder.PageSetup.TextColumns.SetCount(1);

builder.Writeln("THIS MY TITLE (SINGLE COLUMN)");

builder.InsertBreak(BreakType.SectionBreakContinuous);

TextColumnCollection columns = builder.PageSetup.TextColumns;

// Make spacing between columns wider.

builder.PageSetup.TextColumns.Spacing = 30;

// This creates three columns of equal width.

builder.PageSetup.TextColumns.SetCount(3);

for (int i = 0; i < 100; i++)

builder.Writeln(i.ToString());

builder.InsertBreak(BreakType.SectionBreakContinuous);

}

Hope this helps.

Best regards.

Ok that works now

Thank you for the quick help
Emmanuel