I have the following requirement : I have a set of documents
(word, excel and potentially images that come from a PDF conversion)
and I would like to merge them all in one big document.
That big document will then be transformed in PDF. I am using the Java API.
was wondering how to insert an excel document in a word document. I
have read around the examples supplied with Java demos. Very very
impressive but there is nothing about interaction between XLS files and DOC files. I have found how to import the images in the document, how
to merge multiple word documents but I cannot find how to import an
Excel document in a Word document.
Moreover, I would like to
understand how to avoir pitfalls of XLS files that can contain too many
columns to be inserted in my document or how to insert them as
Can you help me please ?
Thanks in advance,
Thanks for your request. I think in your case, the best option is converting all your documents to PDF and then concatenate these PDFs using Apose.Pdf.Kit:
You can use Aspose.Words to convert Word documents and Images to PDF:
Aspose.Cells will allow you to convert Excel documents to PDF:
Aspose.Slides can be used to convert PowerPoint presentations to PDF:
thank you for your answer. I have read that you wrote a converter from XLS to DOC (or the opposite ?).
Was it only for .NET ? because some tool like this would be great. I would like to keep the ability to edit some part of the document (XLS part and DOC part) in the final document.
Do you have any suggestion to be able to do that ? Can I “translate” an XLS grid to a DOC grid ?
Thanks for your request. I attached Java version of this converter here. Please let us know in case of any issues, we are always glad to help you.
thanks a lot. I will try to use it and post the result.
I have tried to import this java class into eclipse. I have cells version 7.0.1 and word 7.0.1 jars in my classpath.
I have a lot of errors that are raised due to problems in API. For instance, NamedRange is not recognized. For which version your converter was done ?
Can I ask you few questions about the API ? I will translate the file for the version 7.0.2 I think.
Thanks for your request. I updated the class for you. Please let us know if you need more assistance, we are always glad to help you.
Thank you for the update. It is very kind. I have tried the converter on an XLS file. I encountered a problem : parsing is failing on cells that contains data that are formatted as number.
The exact error message is the following :
Exception in thread “main” java.lang.IllegalArgumentException: Malformed pattern “#,##0.00’ '€40”
at java.text.DecimalFormat.applyPattern(Unknown Source)
at java.text.DecimalFormat.(Unknown Source)
at com.aspose.cells.b.a.o.a(Unknown Source)
at com.aspose.cells.aR.b(Unknown Source)
at com.aspose.cells.aR.c(Unknown Source)
at com.aspose.cells.aR.a(Unknown Source)
at com.aspose.cells.aR.a(Unknown Source)
at com.aspose.cells.Cell.getStringValue(Unknown Source)
The format of the cell is monetary. Can you tell me how to fix it please ?
Thank you !
Thanks for your request. Could you please attach your Excel file here for testing? I will check it and provide you more information.
the file is attached here.
Thank your for your time !
Thank you for additional information. Please try modifying GetTextFromCell method in the converter as shown below:
/// Get text with formating from Excel cell
/// Input Excel cell
/// Parent document
/// Run that contains text with formating
private Run GetTextFromCell(com.aspose.cells.Cell cell, Document doc) throws Exception
Run run = new Run(doc);
//Convert Excel Font to Words Font
Hope this helps.
Thank you for your answer.
This fix is not really what I expect. The fix ignores the error but I would like to support those number format and insert the value in the word document.
Could you explain me what the methode getStringValue() is doing please ? I can probably do some other parsing to support this.
My understanding (but I haven’t seen aspose code) is that the code is identifying the content of the cell as a double (that is what my debugger says).
When calling getStringValue() on cell, the code is probably searching in the style of the cell what the format is to give the exact representation to the caller. But the problem is that this is not a numeric but a currency. So the format returned is containing an euro symbol (in my case) and the DecimalFormat class is unable to generate the value since the euro sign cannot be parsed. And it is failing with an IllegalArgumentException. Am I on a good track ? Do I have to investigate in the style/format of the cell ?
Thanks for your request. I think, it would be better to ask this question in Aspose.Cells forum. My colleagues from Aspsoe.Cells team have more experience with Excel and Aspose.Cells. So they are standing on better position to help you with this matter.
Thanks a lot Alexey !
I post the question on the cells forum !