@Deprecated public HeaderFooterPolicy getHeaderFooterPolicy() { int last = getDocumentModel().getSections().size(); if (last>0) { // Should always be the case, since we add one, // even if the document contains no sectPr return getDocumentModel().getSections().get(last-1).getHeaderFooterPolicy(); } else { log.error("Unexpected - zero sections?!"); return null; } }
/** * @param filenameHint * @param altText * @param id1 * @param id2 * @param link * @param maxWidth * @return * @throws Exception * @since 3.3.0 */ public Inline createImageInline(String filenameHint, String altText, int id1, int id2, boolean link, int maxWidth) throws Exception { // This signature can scale the image to specified maxWidth WordprocessingMLPackage wmlPackage = ((WordprocessingMLPackage) this.getPackage()); List<SectionWrapper> sections = wmlPackage.getDocumentModel().getSections(); PageDimensions page = sections.get(sections.size() - 1).getPageDimensions(); CxCy cxcy = CxCy.scale(imageInfo, page, maxWidth); return createImageInline(filenameHint, altText, id1, id2, cxcy.getCx(), cxcy.getCy(), link); }
SectionWrapper sw = new SectionWrapper(sectPr, previousHF, rels, evenAndOddHeaders); sections.add(sw); previousHF = sw.getHeaderFooterPolicy(); log.debug( "registered sectpr");
SectPr sectPr = sw.getSectPr();
SectPr sectPr = sw.getSectPr();
@Deprecated public HeaderFooterPolicy getHeaderFooterPolicy() { int last = getDocumentModel().getSections().size(); if (last>0) { // Should always be the case, since we add one, // even if the document contains no sectPr return getDocumentModel().getSections().get(last-1).getHeaderFooterPolicy(); } else { log.error("Unexpected - zero sections?!"); return null; } }
/** * Create a <wp:inline> element suitable for this image, * which can be linked or embedded in w:p/w:r/w:drawing. * If the image is wider than the page, it will be scaled * automatically. * @param filenameHint Any text, for example the original filename * @param altText Like HTML's alt text * @param id1 An id unique in the document * @param id2 Another id unique in the document * @param link true if this is to be linked not embedded * None of these things seem to be exposed in Word 2007's * user interface, but Word won't open the document if * any of the attributes these go in (except @ desc) aren't present! * @throws Exception */ public Inline createImageInline(String filenameHint, String altText, int id1, int id2, boolean link) throws Exception { WordprocessingMLPackage wmlPackage = ((WordprocessingMLPackage) this.getPackage()); List<SectionWrapper> sections = wmlPackage.getDocumentModel().getSections(); PageDimensions page = sections.get(sections.size() - 1).getPageDimensions(); CxCy cxcy = CxCy.scale(imageInfo, page); return createImageInline(filenameHint, altText, id1, id2, cxcy.getCx(), cxcy.getCy(), link); }
SectionWrapper sw = new SectionWrapper(sectPr, previousHF, rels, evenAndOddHeaders); sections.add(sw); previousHF = sw.getHeaderFooterPolicy(); log.debug( "registered sectpr");
List<SectionWrapper> sectionWrappers = template.getDocumentModel().getSections(); for (SectionWrapper sw : sectionWrappers) { HeaderFooterPolicy hfp = sw.getHeaderFooterPolicy(); System.out.println("\n\nSECTION \n"); System.out.println("Headers:"); if (hfp.getFirstHeader()!=null) { System.out.println("-first"); hfp.getFirstHeader().variableReplace(variables); } if (hfp.getDefaultHeader()!=null) { System.out.println("-default"); hfp.getDefaultHeader().variableReplace(variables); } if (hfp.getEvenHeader()!=null) { System.out.println("-even"); hfp.getEvenHeader().variableReplace(variables); } }
String altText = attributes.contains("alt") ? attributes.getValue("alt") : ""; List<SectionWrapper> sections = docx.getPackage().getDocumentModel().getSections(); PageDimensions page = sections.get(sections.size() - 1).getPageDimensions(); double writableWidthTwips = page.getWritableWidthTwips();
FooterPart footer = sw.getHeaderFooterPolicy().getDefaultFooter(); if (footer != null) { Ftr footerDoc = footer.getJaxbElement();
/** * @param filenameHint * @param altText * @param id1 * @param id2 * @param link * @param maxWidth * @return * @throws Exception * @since 3.3.0 */ public Inline createImageInline(String filenameHint, String altText, int id1, int id2, boolean link, int maxWidth) throws Exception { // This signature can scale the image to specified maxWidth WordprocessingMLPackage wmlPackage = ((WordprocessingMLPackage) this.getPackage()); List<SectionWrapper> sections = wmlPackage.getDocumentModel().getSections(); PageDimensions page = sections.get(sections.size() - 1).getPageDimensions(); CxCy cxcy = CxCy.scale(imageInfo, page, maxWidth); return createImageInline(filenameHint, altText, id1, id2, cxcy.getCx(), cxcy.getCy(), link); }
protected Part resolveTextPartForDOCX(Text text, WordprocessingMLPackage wordPackage) { java.util.List<SectionWrapper> sectionWrappers = wordPackage.getDocumentModel().getSections(); for (SectionWrapper sw : sectionWrappers) { HeaderFooterPolicy hfp = sw.getHeaderFooterPolicy(); List<Part> parts = Arrays.<Part>asList(hfp.getFirstHeader(), hfp.getDefaultHeader(), hfp.getEvenHeader(), hfp.getFirstFooter(), hfp.getDefaultFooter(), hfp.getEvenFooter()); for (Part part : parts) { TextMatchCallback callback = new TextMatchCallback(text); new TraversalUtil(part, callback); if (callback.matched) { return part; } } } return wordPackage.getMainDocumentPart(); }
/** * Create a <wp:inline> element suitable for this image, * which can be linked or embedded in w:p/w:r/w:drawing. * If the image is wider than the page, it will be scaled * automatically. * @param filenameHint Any text, for example the original filename * @param altText Like HTML's alt text * @param id1 An id unique in the document * @param id2 Another id unique in the document * @param link true if this is to be linked not embedded * None of these things seem to be exposed in Word 2007's * user interface, but Word won't open the document if * any of the attributes these go in (except @ desc) aren't present! * @throws Exception */ public Inline createImageInline(String filenameHint, String altText, int id1, int id2, boolean link) throws Exception { WordprocessingMLPackage wmlPackage = ((WordprocessingMLPackage) this.getPackage()); List<SectionWrapper> sections = wmlPackage.getDocumentModel().getSections(); PageDimensions page = sections.get(sections.size() - 1).getPageDimensions(); CxCy cxcy = CxCy.scale(imageInfo, page); return createImageInline(filenameHint, altText, id1, id2, cxcy.getCx(), cxcy.getCy(), link); }
protected Part resolveTextPartForDOCX(Text text, WordprocessingMLPackage wordPackage) { java.util.List<SectionWrapper> sectionWrappers = wordPackage.getDocumentModel().getSections(); for (SectionWrapper sw : sectionWrappers) { HeaderFooterPolicy hfp = sw.getHeaderFooterPolicy(); List<Part> parts = Arrays.asList(hfp.getFirstHeader(), hfp.getDefaultHeader(), hfp.getEvenHeader(), hfp.getFirstFooter(), hfp.getDefaultFooter(), hfp.getEvenFooter()); for (Part part : parts) { TextMatchCallback callback = new TextMatchCallback(text); new TraversalUtil(part, callback); if (callback.matched) { return part; } } } return wordPackage.getMainDocumentPart(); }
if (reportRegion.isTabulatedRegion()) { mainDocumentPart.addParagraphOfText(""); int writableWidthTwips = wordMLPackage.getDocumentModel().getSections().get(0).getPageDimensions().getWritableWidthTwips(); int cols = reportRegion.getRegionProperties().size(); int cellWidthTwips = new Double(Math.floor((writableWidthTwips / cols))).intValue();
protected void collectHeadersAndFooters() {//collect data from headers List<SectionWrapper> sectionWrappers = wordprocessingMLPackage.getDocumentModel().getSections(); for (SectionWrapper sw : sectionWrappers) { HeaderFooterPolicy hfp = sw.getHeaderFooterPolicy(); collectDataFromObjects(hfp.getFirstHeader(), hfp.getDefaultHeader(), hfp.getEvenHeader(), hfp.getFirstFooter(), hfp.getDefaultFooter(), hfp.getEvenFooter()); } }
protected void collectHeadersAndFooters() {//collect data from headers List<SectionWrapper> sectionWrappers = wordprocessingMLPackage.getDocumentModel().getSections(); for (SectionWrapper sw : sectionWrappers) { HeaderFooterPolicy hfp = sw.getHeaderFooterPolicy(); collectDataFromObjects(hfp.getFirstHeader(), hfp.getDefaultHeader(), hfp.getEvenHeader(), hfp.getFirstFooter(), hfp.getDefaultFooter(), hfp.getEvenFooter()); } }