return finishBuffering();
}
private String generateSectionStyle(final int columnCount)
{
final OfficeStyles automaticStyles = getStylesCollection().getAutomaticStyles();
final String styleName = getAutoStyleNameGenerator().generateName("auto_section_style");
final Section sectionProperties = new Section();
sectionProperties.setNamespace(OfficeNamespaces.STYLE_NS);
sectionProperties.setType("section-properties");
sectionProperties.setAttribute(OfficeNamespaces.FO_NS, "background-color", "transparent");
sectionProperties.setAttribute(OfficeNamespaces.TEXT_NS, "dont-balance-text-columns", "false");
sectionProperties.setAttribute(OfficeNamespaces.STYLE_NS, "editable", "false");
if (columnCount > 1)
{
final Section columns = new Section();
columns.setNamespace(OfficeNamespaces.STYLE_NS);
columns.setType("columns");
columns.setAttribute(OfficeNamespaces.FO_NS, "column-count", String.valueOf(columnCount));
columns.setAttribute(OfficeNamespaces.STYLE_NS, "column-gap", "0cm");
sectionProperties.addNode(columns);
// final Section columnSep = new Section();
// columnSep.setNamespace(OfficeNamespaces.STYLE_NS);
// columnSep.setType("column-sep");
// columnSep.setAttribute(OfficeNamespaces.STYLE_NS, "width", "0.035cm");
// columnSep.setAttribute(OfficeNamespaces.STYLE_NS, "color", "#000000");
// columnSep.setAttribute(OfficeNamespaces.STYLE_NS, "height", "100%");
// columns.addNode(columnSep);
for (int i = 0; i < columnCount; i++)
{
final Section column = new Section();
column.setNamespace(OfficeNamespaces.STYLE_NS);
column.setType("column");
column.setAttribute(OfficeNamespaces.STYLE_NS, "rel-width", "1*");
column.setAttribute(OfficeNamespaces.FO_NS, "start-indent", "0cm");
column.setAttribute(OfficeNamespaces.FO_NS, "end-indent", "0cm");
columns.addNode(column);
}
}
final OfficeStyle style = new OfficeStyle();
style.setNamespace(OfficeNamespaces.STYLE_NS);
style.setType("style");
style.setAttribute(OfficeNamespaces.STYLE_NS, "name", styleName);
style.setAttribute(OfficeNamespaces.STYLE_NS, "family", "section");
style.addNode(sectionProperties);
automaticStyles.addStyle(style);
return styleName;
}