Java and word+fusionchart generation chart in depth analysis

  • 2020-04-01 01:08:43
  • OfStack

Fusionchart was used in a friend's project, and word download function of multiple reports needed to be provided at the same time.
It's just a tough one, no doubt.

Fusionchart provides the function of the server side and the client side to generate pictures, which is based on the client side to show flash later.
My friend's project is based on Linux, and the com mechanism of office itself cannot be called through Jacob.
Pure Java operations word, POI and docx4j, can generate word documents, tables, insert pictures.

A viable idea When you click to download the report, first open the charts of each flash on a new page, and then call the function of fusoinchart to generate pictures on the server side.
Finally, js calls the servlet to generate doc and inserts the images generated in the previous step into the document.
The strategy performance of this curve is very low.

Second thought Is to insert flash directly into word, as ole into word, while mixing with other content. This method should be performance should be ok, open by word to real-time rendering flash.
However, I found that if word used OLE doc, it could not use HWPF, and I could only spell BIFF files a little by myself. This is really difficult to do, and I do not know whether OLE can be displayed in it.
To give up. PS: found a simple support for ActiveX in the function of WSPH processing PPT... I'll go..

Third thought It is to get the data generated by chart and directly use the chart function of office. Unfortunately, it is found that there is no such function in HWPF, but only in the function of HSSF processing excel.

The last method is relatively simple and feasible, with fair performance. Jfreechart is used in the background to generate pictures and then generate word documents.
The downside is that the charting style is inconsistent with fusion. Jfree is so ugly. But this method is the most suitable one that can be thought of at present.

Related articles: