We're sorry Aspose doesn't work properply without JavaScript enabled.

Free Support Forum - aspose.com

Error extracting excel files from DOCXs (the output file can't be opened by excel)

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

Hi

Thanks for your inquiry. Could you please attach your document here for testing? I will check the issue on my side and provide you more information.

Best regards.

**Hi Alexey,

Thanks for the quick reply and here’s the file.**

Hi

Thank you for additional information. I managed to reproduce the problem on my side. You will be notified as soon as the issue is resolved.

Best regards.

Wow,

Thanks a lot Alexey! Do you have any idea of when this fix will be available?

Thanks again,
Augusto

Hi Augusto,

Thanks for your inquiry. Unfortunately, It is difficult to provide you any estimate regarding this issue at the moment. Please expect a reply before next hotfix (within 4-5 weeks).

Best regards.

Hi Augusto,

This seems to be some strange behavior of MS Excel. It opens the XLS document but as a hidden workbook.

If you are in Excel 2007 then click on the View tab and click Unhide to see your workbook.

We will investigate if it is possible to make it open visible.

Well, I’ve actually fixed this! I’ve made Aspose.Words to automatically unhide the workbook in the XLS file (just changing one bit in the XLS file) when exporting from an OLE object. Will be released in a day or two.

The issues you have found earlier (filed as 9995) have been fixed in this update.


This message was posted using Notification2Forum from Downloads module by aspose.notifier.