private static String GetSectionStyle(Section section) { float leftMargin = section.MarginLeft / AbstractWordUtils.TWIPS_PER_INCH; float rightMargin = section.MarginRight / AbstractWordUtils.TWIPS_PER_INCH; float topMargin = section.MarginTop / AbstractWordUtils.TWIPS_PER_INCH; float bottomMargin = section.MarginBottom / AbstractWordUtils.TWIPS_PER_INCH; String style = "margin: " + topMargin + "in " + rightMargin + "in " + bottomMargin + "in " + leftMargin + "in;"; if (section.NumColumns > 1) { style += "column-count: " + (section.NumColumns) + ";"; if (section.IsColumnsEvenlySpaced) { float distance = section.DistanceBetweenColumns / AbstractWordUtils.TWIPS_PER_INCH; style += "column-gap: " + distance + "in;"; } else { style += "column-gap: 0.25in;"; } } return style; }
protected override void ProcessSection(HWPFDocumentCore wordDocument, NPOI.HWPF.UserModel.Section section, int s) { XmlElement sectionElement = textDocumentFacade.CreateBlock(); ProcessParagraphes(wordDocument, sectionElement, section, int.MinValue); sectionElement.AppendChild(textDocumentFacade.CreateText("\n")); textDocumentFacade.Body.AppendChild(sectionElement); }
protected String CreatePageMaster(NPOI.HWPF.UserModel.Section section, String type, int sectionIndex) { float height = section.PageHeight / WordToFoUtils.TWIPS_PER_INCH; float width = section.PageWidth / WordToFoUtils.TWIPS_PER_INCH; float leftMargin = section.MarginLeft / WordToFoUtils.TWIPS_PER_INCH; float rightMargin = section.MarginRight / WordToFoUtils.TWIPS_PER_INCH; float topMargin = section.MarginTop / WordToFoUtils.TWIPS_PER_INCH; float bottomMargin = section.MarginBottom / WordToFoUtils.TWIPS_PER_INCH; // add these to the header String pageMasterName = type + "-page" + sectionIndex; XmlElement pageMaster = foDocumentFacade.AddSimplePageMaster(pageMasterName); pageMaster.SetAttribute("page-height", height + "in"); pageMaster.SetAttribute("page-width", width + "in"); XmlElement regionBody = foDocumentFacade.AddRegionBody(pageMaster); regionBody.SetAttribute("margin", topMargin + "in " + rightMargin + "in " + bottomMargin + "in " + leftMargin + "in"); /* * 6.4.14 fo:region-body * * The values of the padding and border-width traits must be "0". */ // WordToFoUtils.setBorder(regionBody, sep.getBrcTop(), "top"); // WordToFoUtils.setBorder(regionBody, sep.getBrcBottom(), "bottom"); // WordToFoUtils.setBorder(regionBody, sep.getBrcLeft(), "left"); // WordToFoUtils.setBorder(regionBody, sep.getBrcRight(), "right"); if (section.NumColumns > 1) { regionBody.SetAttribute("column-count", "" + (section.NumColumns)); if (section.IsColumnsEvenlySpaced) { float distance = section.DistanceBetweenColumns / WordToFoUtils.TWIPS_PER_INCH; regionBody.SetAttribute("column-gap", distance + "in"); } else { regionBody.SetAttribute("column-gap", "0.25in"); } } return(pageMasterName); }
protected override void ProcessSection(HWPFDocumentCore wordDocument, NPOI.HWPF.UserModel.Section section, int sectionCounter) { String regularPage = CreatePageMaster(section, "page", sectionCounter); XmlElement pageSequence = foDocumentFacade.AddPageSequence(regularPage); XmlElement flow = foDocumentFacade.AddFlowToPageSequence(pageSequence, "xsl-region-body"); ProcessParagraphes(wordDocument, flow, section, int.MinValue); if (endnotes != null && endnotes.Count != 0) { foreach (XmlElement endnote in endnotes) { flow.AppendChild(endnote); } endnotes.Clear(); } }
protected void processSingleSection(HWPFDocumentCore wordDocument, Section section) { htmlDocumentFacade.AddStyleClass(htmlDocumentFacade.Body, "b", GetSectionStyle(section)); ProcessParagraphes(wordDocument, htmlDocumentFacade.Body, section, int.MinValue); }
protected override void ProcessSection(HWPFDocumentCore wordDocument, Section section, int s) { XmlElement div = htmlDocumentFacade.CreateBlock(); htmlDocumentFacade.AddStyleClass(div, "d", GetSectionStyle(section)); htmlDocumentFacade.Body.AppendChild(div); ProcessParagraphes(wordDocument, div, section, int.MinValue); }