Spire.Doc is a professional Word .NET library specifically designed for developers to create, read, write, convert and print Word document files. Get free and professional technical support for Spire.Doc for .NET, Java, Android, C++, Python.

Wed Aug 24, 2022 3:22 pm

Hello. I can't find how move charts from excel to word. I use Java + Spire.doc. There aren't examples in the website or I don't find. I think that library should have method for work with charts. If there is a way then write to me please.

biskvitka
 
Posts: 8
Joined: Thu Sep 10, 2020 5:47 pm

Thu Aug 25, 2022 3:49 am

Hello biskvitka,

Thanks for your inquiry.
Our Spire.Doc supports embedding the Excel charts into Doc file by OLE method, as shown in the below code. I also attached my testing file for your reference. If there is any other issues, just feel free to write back.
Code: Select all
     //Create a document
        Document doc = new Document();

        //Add a section
        Section sec = doc.addSection();

        //Add a paragraph
        Paragraph par = sec.addParagraph();

        //Load the image
        DocPicture picture = new DocPicture(doc);
        picture.loadImage("excel.png");

        //Insert the OLE
        DocOleObject obj = par.appendOleObject("example.xlsx", picture, OleObjectType.Excel_Worksheet);

        //Save to file
        String output = "insertOLE.docx";
        doc.saveToFile(output, FileFormat.Docx_2013);

Sincerely,
Simple
E-iceblue support team
User avatar

Simple.Li
 
Posts: 248
Joined: Fri Jul 01, 2022 2:33 am

Mon Aug 29, 2022 5:52 pm

If I get that right You are saying that i can only insert chart to word like picture

biskvitka
 
Posts: 8
Joined: Thu Sep 10, 2020 5:47 pm

Tue Aug 30, 2022 8:22 am

Hello,

Thanks for your feedback.
When you use our product to insert OLE into a Word document, the linked picture icon need to be added by code. I attached "output.docx" which was created by our product. You can double click the picture icon to view the Excel file content. If there is still any doubts, just feel free to contact.

Sincerely,
Lisa
E-iceblue support team
User avatar

Lisa.Li
 
Posts: 1261
Joined: Wed Apr 25, 2018 3:20 am

Sat Sep 03, 2022 10:33 am

I didn't understand you example.How did you do picture from excel? I know how insert picture in word but i don't know how do picture from excel. How I have to do picture if i know amount rows and columns which chart takes place

biskvitka
 
Posts: 8
Joined: Thu Sep 10, 2020 5:47 pm

Mon Sep 05, 2022 11:10 am

Hello biskvitka,

Thanks for your inquiry.
You can refer to the tutorial (Convert Excel to Image) save the Excel to image. If you have any further questions, please feel free to contact us.
Sincerely,
Simple
E-iceblue support team
User avatar

Simple.Li
 
Posts: 248
Joined: Fri Jul 01, 2022 2:33 am

Sun Sep 11, 2022 1:58 pm

Thank you :)

biskvitka
 
Posts: 8
Joined: Thu Sep 10, 2020 5:47 pm

Tue Sep 13, 2022 6:06 am

Hello biskvitka,

You are welcome. If you have any further questions, please feel free to contact us.

Sincerely,
Simple
E-iceblue support team
User avatar

Simple.Li
 
Posts: 248
Joined: Fri Jul 01, 2022 2:33 am

Return to Spire.Doc

cron