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

Free Support Forum - aspose.com

Dynamically generated docx file

I need to generate a docx file that can be assembled from diff data sources online.
Data Sources can be DB like sql_server , files like html, doc, docx , xls, xlsx , images, pdf.
All files information is kept as binary’s in SQL SERVER table for usage.
The data from different sources should be combind anyware in the result file, and than sent to print or kept DB/File.
How can it be accomplish using aspos class libraries ?
Is there an intermidate format to be use ?
I am also looking for the source of xls2doc ?


Thanks for your interest in Aspose products. Please see the following link to learn about file formats supported by Aspose.Words:
I think the best way to fill the document with data is using Mail Merge feature. Please follow this link to learn more:
Or you can use Mail Merge with regions. Please see the following link:
If you would like to use bookmarks please follow the link to learn how to work with bookmarks:
There is no direct way to convert Excel to doc. But you can create your own converter to achieve this using Aspose.Words and Aspose.Cells. As example you can try using Excel2Word demo project created using Aspose.Cells and Aspose.Words. You can download this demo from here:
Best regards,

I have downloaded the example and run it.
The output file has the following messege in it " This document was truncated here because it was created using Aspose.Word in Evaluation Mode."
I assume it’s a resault of asking for license files in the code for Aspose.Words and Aspose.Cells ?
The main idea was to enable my superiors view/proof the concept of converting excel document to word document. This rapid demo would promote the need to buy your products.
Is there a way to get a license file that would enable runing for limited time on evaluation .

Hi there,
Thanks for considering Aspose.
Yes you are correct, this watermark is added and content truncated because Aspose.Words is running in evaluation mode because a license has not been loaded.
You can request a 30 day temporary license to test applications without these watermarks, please see the link here for details.

Thank you for the temporary license.
While trying to convert excel to docx file I found out that I get a mirror “image” of the source in the output file.
for example : excel file has tables including right to left lang like hebrew.
The resault file docx has the same table cells text is a mirror image of the original one. Table columns are also placed as mirror image of the original table .
Did you know ? Is there a known solution ?


Thanks for your request. ExcelToWord is just a demo, which demonstrates the technique. You are free to change the code, so you can implement supporting RTL yourself. You can use Bidi properties of Fort, RowFormat, ParagraphFormat and PageSetup in Aspose.Words.
Hope this helps. Please let me know if you need more information, I will be glad to help you.
Best regards.

Well your advise did work fine - Thanks.
Do you happen to have an updated convert xls to word demo ?
I still have some problems and would like yo have your help :

  1. pictures and charts that were set on different sheet didn’t convert to correct size ?
  2. text with background converted to document paragraph with multi lines:
    abcd efgh hhhhh -> abcd
  3. tables column size aren’t as the originals ?
  4. while moving from sheets the page breaks on the word aren’t correct - does this demo has some kind of policy ?
    If you could guide me it might shortten the time to fix the above issues.


Thanks for your request. It is difficult to say what the problem is without your documents. Also, you should note that Excel and Word documents are different and it is difficult and sometimes impossible to get exactly the same result in Word as you have in Excel.
Anyways, even in current state the demo gives an acceptable result and can be used to convert Excel document to Word documents. If you have problems with converting some particular Excel sheets to Word, you should attach these sheets here for testing and describe the problems. I will check the issue and try to help you.
Best regards.

Well again I agree that you need some sort of data to the view things.
I have prepared some simple examples in file Book1.xls and their resault in Book1 out . docx


Thank you for additional information. It seems you missed to attach your source Excel sheet. Could you please attach it for testing?
Best regards.

Sending missing files.
I am in a phase of learning the demo code to find out whats going wrong and try to fix it before my temp license expires.
I think the code fault lies on migrating collected items from excel to word and positioning them on the created word doc pages.
Good Luck.


Thank you for additional information. The problem with images occurs because all images in Excel are floating, i.e. they do not affect width of column, where they are located. That is why width of images is not taken into account when width of table is calculated.
You can correct this behavior, but you can face another problem. Column, which contains an image may also contain other data. If you expand column with to width of an image, this content might be improperly wrapped.
Best regards.

Thanks for the knowledge.
I have had the following idea - create table for each image /chart ( if the rule apply to it) where the dimensions are the image ones.
In case of more than one node in a cell create more than one table lets one for each by type. In the word render them all one by one.
Is it possible to create a table with one row one cell in aspose.Words ?
If you have some other ideas I will be glad to know.
Best Wishes.

Hi there,
Yes this is possible, please see the documentation here on inserting elements with the Document Builder.
In your case you would just want to create a table, insert one cell and then end the table. i.e

Cell cell = builder.InsertCell();

Then you can append all the applicable children to the cell using cell.AppendChild(…).
If you need any further assitance please feel free to ask,