@Override protected void appendSectionHeader(HTMLConversionContext conversionContext, Document document, ConversionSectionWrapper sectionWrapper, Element currentParent) throws Docx4JException { if (XsltCommonFunctions.hasDefaultHeader(conversionContext)) { appendPartContent( conversionContext, document, sectionWrapper, currentParent, "header", sectionWrapper.getHeaderFooterPolicy().getDefaultHeader(), sectionWrapper.getHeaderFooterPolicy().getDefaultHeader().getJaxbElement().getContent()); } }
public static boolean hasDefaultHeader(AbstractWmlConversionContext context) { ConversionSectionWrapper currentSection = context.getSections().getCurrentSection(); return (currentSection.getHeaderFooterPolicy().getDefaultHeader() != null); }
public static void setCurrentPartDefaultHeader(AbstractWmlConversionContext context) { ConversionSectionWrapper currentSection = context.getSections().getCurrentSection(); context.setCurrentPart(currentSection.getHeaderFooterPolicy().getDefaultHeader()); }
public static void inDefaultHeader(AbstractWmlConversionContext context) { ConversionSectionWrapper currentSection = context.getSections().getCurrentSection(); setCurrentPart(context, currentSection.getHeaderFooterPolicy().getDefaultHeader()); }
public static boolean hasDefaultHeaderOrFooter(AbstractWmlConversionContext context) { ConversionSectionWrapper currentSection = context.getSections().getCurrentSection(); return (currentSection.getHeaderFooterPolicy().getDefaultHeader()!=null) || (currentSection.getHeaderFooterPolicy().getDefaultFooter()!=null); }
public static Node getDefaultHeader(AbstractWmlConversionContext context) { ConversionSectionWrapper currentSection = context.getSections().getCurrentSection(); Hdr hdr = currentSection.getHeaderFooterPolicy().getDefaultHeader().getJaxbElement(); return XmlUtils.marshaltoW3CDomDocument(hdr); }
public static PageNumberInformation process(ConversionSectionWrapper sectionWrapper, boolean dummyPageNumbering) { PageNumberInformation ret = new PageNumberInformation(sectionWrapper.getSectPr()); FieldVisitor fldVisitor = null; HeaderFooterPolicy headerFooterPolicy = sectionWrapper.getHeaderFooterPolicy(); //If it is a dummyPageNumberInformation the data is read from the sectPr, //and it is assumed that there are no NUMPAGES and SECTIONPAGES fields //the result will allways be a single pass conversion. if (!dummyPageNumbering) { fldVisitor = new FieldVisitor(ret); TraversalUtil.visit(sectionWrapper.getContent(), fldVisitor); process(headerFooterPolicy.getFirstHeader(), fldVisitor); process(headerFooterPolicy.getFirstFooter(), fldVisitor); process(headerFooterPolicy.getDefaultHeader(), fldVisitor); process(headerFooterPolicy.getDefaultFooter(), fldVisitor); process(headerFooterPolicy.getEvenHeader(), fldVisitor); process(headerFooterPolicy.getEvenFooter(), fldVisitor); } return ret; }
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); } }
@Override protected void appendSectionHeader(HTMLConversionContext conversionContext, Document document, ConversionSectionWrapper sectionWrapper, Element currentParent) throws Docx4JException { if (XsltCommonFunctions.hasDefaultHeader(conversionContext)) { appendPartContent( conversionContext, document, sectionWrapper, currentParent, "header", sectionWrapper.getHeaderFooterPolicy().getDefaultHeader(), sectionWrapper.getHeaderFooterPolicy().getDefaultHeader().getJaxbElement().getContent()); } }
public static boolean hasDefaultHeader(AbstractWmlConversionContext context) { ConversionSectionWrapper currentSection = context.getSections().getCurrentSection(); return (currentSection.getHeaderFooterPolicy().getDefaultHeader() != null); }
public static void inDefaultHeader(AbstractWmlConversionContext context) { ConversionSectionWrapper currentSection = context.getSections().getCurrentSection(); setCurrentPart(context, currentSection.getHeaderFooterPolicy().getDefaultHeader()); }
public static void setCurrentPartDefaultHeader(AbstractWmlConversionContext context) { ConversionSectionWrapper currentSection = context.getSections().getCurrentSection(); context.setCurrentPart(currentSection.getHeaderFooterPolicy().getDefaultHeader()); }
public static boolean hasDefaultHeaderOrFooter(AbstractWmlConversionContext context) { ConversionSectionWrapper currentSection = context.getSections().getCurrentSection(); return (currentSection.getHeaderFooterPolicy().getDefaultHeader()!=null) || (currentSection.getHeaderFooterPolicy().getDefaultFooter()!=null); }
public static Node getDefaultHeader(AbstractWmlConversionContext context) { ConversionSectionWrapper currentSection = context.getSections().getCurrentSection(); Hdr hdr = currentSection.getHeaderFooterPolicy().getDefaultHeader().getJaxbElement(); return XmlUtils.marshaltoW3CDomDocument(hdr); }
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(); }
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(); }
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()); } }
public static PageNumberInformation process(ConversionSectionWrapper sectionWrapper, boolean dummyPageNumbering) { PageNumberInformation ret = new PageNumberInformation(sectionWrapper.getSectPr()); FieldVisitor fldVisitor = null; HeaderFooterPolicy headerFooterPolicy = sectionWrapper.getHeaderFooterPolicy(); //If it is a dummyPageNumberInformation the data is read from the sectPr, //and it is assumed that there are no NUMPAGES and SECTIONPAGES fields //the result will allways be a single pass conversion. if (!dummyPageNumbering) { fldVisitor = new FieldVisitor(ret); TraversalUtil.visit(sectionWrapper.getContent(), fldVisitor); process(headerFooterPolicy.getFirstHeader(), fldVisitor); process(headerFooterPolicy.getFirstFooter(), fldVisitor); process(headerFooterPolicy.getDefaultHeader(), fldVisitor); process(headerFooterPolicy.getDefaultFooter(), fldVisitor); process(headerFooterPolicy.getEvenHeader(), fldVisitor); process(headerFooterPolicy.getEvenFooter(), fldVisitor); } return ret; }