hi,all:
i want to modify the text in the head,below is my code
import java.io.File;
import java.util.HashMap;
import java.util.List;
import org.docx4j.XmlUtils;
import org.docx4j.model.structure.HeaderFooterPolicy;
import org.docx4j.model.structure.SectionWrapper;
import org.docx4j.openpackaging.packages.WordprocessingMLPackage;
import org.docx4j.openpackaging.parts.WordprocessingML.HeaderPart;
public class TestMidfyHeader
{
public static void main(String[] str)throws Exception
{
String inputfilepath = "C:\\workspace\\Doc1.docx";
WordprocessingMLPackage wordMLPackage = WordprocessingMLPackage.load(new java.io.File(inputfilepath));
List<SectionWrapper> sectionWrappers = wordMLPackage.getDocumentModel().getSections();
for (SectionWrapper sw : sectionWrappers)
{
HeaderFooterPolicy hfp = sw.getHeaderFooterPolicy();
HeaderPart header= hfp.getDefaultHeader();
String xml=XmlUtils.marshaltoString(header.getJaxbElement(), true);
HashMap<String, String> mappings = new ...