Free Support Forum - aspose.com

Support for RTF dual column (newspaper-type flow)

Does Aspro.word support dual column (newspaper-type flow) , in that the text first fills one column , then another column? ... if so, please post an example.

Thanks,

Gerald

Hi Gerald,


Thanks for your interest in Aspose.Words. Yes, Aspose.Words supports Text Columns. Please refer to the following sections of the documentation which outlines everything you need to know about TextColumn:
http://www.aspose.com/docs/display/wordsjava/TextColumn

Please let me know if I can be of any further assistance.

Best regards,

Thank you for the response ... also, do we have the ability for partial two column page ? ... meaning on one page the first half with one column and the second half with two columns.

Thank you,

Gerald

Hi Gerald,

Thanks for your inquiry. Could you please attach your target Word document showing the desired output here for testing. I will investigate as to how you are expecting your final document to be generated like. You can use Microsoft Word to create your target Word document. I will then provide you code to achieve the same using Aspose.Words.

Best regards,

Hello Awais,

Attached word document is an sample of the output.

Note: We are looking to covert HTML to RTF, let me know if the software needs any special tags added in the HTML to produce the desired output.

Thanks,

Gerald

Hi Gerald,


Thanks for the additional information. You can generate a similar output by using the following code snippet:
DocumentBuilder builder = new DocumentBuilder();

builder.writeln("One column part of document ");
builder.writeln();

builder.insertBreak(BreakType.SECTION_BREAK_CONTINUOUS);

TextColumnCollection columns = builder.getPageSetup().getTextColumns();
// Show vertical line between columns.
columns.setLineBetween(true);
// Indicate we want to create column with different widths.
columns.setEvenlySpaced(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.get(0);
c1.setWidth(100);
c1.setSpaceAfter(20);

// Set the second column to take the rest of the space available on the page.
TextColumn c2 = columns.get(1);
PageSetup ps = builder.getPageSetup();
double contentWidth = ps.getPageWidth() - ps.getLeftMargin() - ps.getRightMargin();
c2.setWidth(contentWidth - c1.getWidth() - c1.getSpaceAfter());

builder.writeln(“Narrow column 1.”);
builder.insertBreak(BreakType.COLUMN_BREAK);
builder.writeln(“Wide column 2.”);

builder.insertBreak(BreakType.SECTION_BREAK_CONTINUOUS);
builder.getCurrentSection().getPageSetup().getTextColumns().setCount(1);
builder.getCurrentSection().getPageSetup().getTextColumns().setEvenlySpaced(true);

builder.insertBreak(BreakType.SECTION_BREAK_CONTINUOUS);

builder.writeln(“One column part of document”);

builder.getDocument().save(“C:\Temp\out.docx”);

I hope, this helps.

Best regards,