It is currently Thu Aug 14, 2025 1:39 pm
SpreadsheetMLPackage pkg = SpreadsheetMLPackage.createPackage();
factory = Context.getsmlObjectFactory();
WorksheetPart sheet = pkg.createWorksheetPart(new PartName("/xl/worksheets/sheet1.xml"), "Test Dossier", 1);
//Extract from file styles.xml
URL furl = ExcelWriter.class.getResource("styles.xml");
File knownstyles = new File(furl.toURI());
JAXBContext jc = org.docx4j.jaxb.Context.jc;
Unmarshaller u = jc.createUnmarshaller();
u.setEventHandler(new org.docx4j.jaxb.JaxbValidationEventHandler());
Styles styles = (Styles) u.unmarshal(knownstyles); //EXCEPTION THROWN HERE
pkg.addTargetPart(styles);
WARN JaxbValidationEventHandler : [ERROR] : unexpected element (uri:"http://schemas.openxmlformats.org/wordprocessingml/2006/main", local:"body"). Expected elements are <{http://schemas.microsoft.com/office/2006/xmlPackage}body>,<{http://schemas.microsoft.com/office/2006/xmlPackage}background>
INFO JaxbValidationEventHandler : continuing (with possible element/attribute loss)
cannot find symbol
[javac] symbol : class Logger
[javac] location: class org.docx4j.convert.in.Doc
[javac] private static Logger log = Logger.getLogger(Doc.class);
Total posts 10189 • Total topics 2867 • Total members 2097