Hi,
I’m evaluating Aspose.Words for our project, but I’m having some trouble to extract an Excel attachment (version 8 / 2003) from a DOCX (word 2007). If someone from aspose can contact me, I can send the actual DOCX.
When I try to open the file with Excel 2007 I get a warning, because the excel has some macros (this is normal), but then it doesn’t show anything. And when I try to close excel, it asks me if I want to save the changes made to the file. If I click yes, the file size goes from 9mb to 7mb (the original excel file is 7mb).
This is the code I’m running.
#CODE#
**public class AsposeTest {
public static void main(String[] args) throws Exception {
new AsposeTest().run();
}
private void run() throws Exception {
License license = new License();
license.setLicense(getAsStream(“Aspose.Words.lic”));
Document doc = new Document( getAsStream( “excelTest.docx” ) );
NodeCollection childNodes = doc.getChildNodes(NodeType.ANY, true, true);
for (Node node : childNodes) {
if ( node.getNodeType() == NodeType.SHAPE ) {
Shape shape = (Shape) node;
if( shape.getOleFormat() != null ) {
OleFormat oleFormat = shape.getOleFormat();
FileOutputStream out = new FileOutputStream(“c:\output.xls”);
oleFormat.save(out);
out.close();
}
}
}
}
public InputStream getAsStream(String fileName) {
return AsposeTest.class.getClassLoader().getResourceAsStream( fileName );
}
}**
____
I would really appreciate if someone can give me a hint of what I might be doing wrong.
Thanks a lot,
Augusto