Newbie question: Aspose.Word - images- tables- etc


#1

i am trying to automatically generate reports in Word. i almost purchased SoftArtisans, but you guys seem alot better.

anyways, these reports pull from a database and some of the images are graphs that are dynamically generated via some 3rd party component (example img src=“graph1.asp?city=3”). Will i be ok in Aspose.Word?

also, alot of data is placed in tables that are customized a certain way (i.e., border around the whole table but no border around individual rows, cells) and if the data does not exist, i don’t want the table row to appear.

can i do all this? btw, the report will be about 80 pages with lots of data. your input is appreciated.

Regards,

Dean


#2

You can build a document/report in Aspose.Word either using mail merge or using DocumentBuilder or a combination of both.

Using mail merge is nice because you can design your document visually in MS Word and just insert the data you need and dynamically grow the document or regions inside it for rows in your data source.

Using DocumentBuilder gives you direct control over content of the document you create, you can insert and format almost any Word document elements. This requires more programming, less visual design.

You can combine benefits from both approaches if you start mail merge and use DocumentBuilder inside the MergeField event handler.

Yes, you can insert images into the document both during mail merge using special field name such as Image:MyImageFile or using DocumentBuilder.InsertImage method. You can also use Aspose.Chart to generate chart images.

To build tables in the way you want it is probably best to use DocumentBuilder methods and properties. You can specify every border explicitly for every cell if you want.

In your case, the image is obtained from a URL. You need to use .NET WebRequest and WebResponse classes to request the URL and obtain the response stream. The image will be in that stream and you can use it to insert the image into the document. Search the forums for WebRequest, there is an example available.