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

Free Support Forum - aspose.com

Extract a table of content from Excel to Word using Aspose with Java

Hi

Now my requirement is I have to take a table of content from Excel and paste it in Word document using Aspose with Java.

Is there any possibility that I can do some kind of copy and paste from Excel to Word.

I want to select a range of cells only. like C1...D13(which has two columns and 13 rows.

It is my doubt can anyone help me?

Thanks in Advance

Madhu

Hi,

Yes, I think you may use Cells.exportArray() method to fill a two dimensional array and later paste it into the word document using Aspose.Word API.

Thank you.

Hi Amjad,

I am very new to this Aspose usage.

Can you please tell me how can I implement Cells.exportArray() Using Aspose with Java.

I want to maintain te same format like backgroung colour of cell to be same in the word document also.

Can you help me?

Thanks in Advance

Madhu

Hi,

Well Cells.exportArray() will only export data not formattings, check the doc how you can use the method: http://www.aspose.com/documentation/file-format-components/aspose.cells-for-.net-and-java/exporting-data-from-worksheets.html If you want to extract data with formattings, there is no direct way to do the task. I think you may try to iterate the source cells one by one in a loop, check each cell to get its data and formattings usng the methods e.g., Cell.getValue and Cell.getStyle(), now paste the values and re-format the data accordingly using Aspose.Words API.

Thank you.

Hi Amjad,

Thanks for your valuable suggestion.

I am checking it out.

Once it is done I will let you know.

Thnaks

madhu

Hi Amjad

I worked with the code given by you.

The object has information. But my doubt is how can I paste or write that object to Word Document.

Please help me as I am very new to use this Aspose

Here is the code line of me.

Object dataTable [][] = worksheet.getCells().exportArray(74,7,54,6);

Thanks

Madhu

Hi Madhu,

Sorry, I am not familiar with Aspose.Words API. I think you can check Aspose.Words documentation: http://www.aspose.com/documentation/file-format-components/aspose.words-for-.net-and-java/index.html or post a query @ Aspose.Words forum: http://www.aspose.com/community/forums/aspose.words-for-.net-java-and-reporting-services/75/showforum.aspx and I am sure they will help you soon.

Thank you.

Hi Amjad,

Thank you fo ryour replies.

I posted my message in Aspose.Words forum.

Bye

Madhu

Hi,

I have a doubt in Aspose Cells like

what is the Exact replacement for TextOrientationType(in C#) for java

Thanks

Madhu

Hi Madhu,

Do you use TextBox object, well, in the java version, you may use MsoTextOrientation interface in parallel:

http://www.aspose.com/documentation/file-format-components/aspose.cells-for-.net-and-java/com/aspose/cells/msotextorientation.html

To set the text orientation in a textbox, kindly use TextBox.setOrientation() method:

http://www.aspose.com/documentation/file-format-components/aspose.cells-for-.net-and-java/com/aspose/cells/textbox.html

Thank you.

Hi Amjad,

Thanks for your information.

How can I convert picture type to shape type in Java.

Exactly what happened is that I have C# code where to there is direct convertion has done like this.

private com.aspose.words.Shape ConvertPictureToShape(com.aspose.cells.Picture excelPicture, Document doc)
{
//Create new Shape
com.aspose.words.Shape wordsShape=null;
try
{
wordsShape = new com.aspose.words.Shape(doc, com.aspose.words.ShapeType.IMAGE);
//Set image
wordsShape.getImageData().setImage(excelPicture.toString());
//Import Picture properties inhereted from Shape
ImportShapeProperties(wordsShape, (Shape)excelPicture);
}
catch(Exception e)
{
e.printStackTrace();
}
return wordsShape;
}

Actually the bolded thing is giving me error.

It is saying that you can not convert picture type to Shape directly. I have ImportShapeProperties method.

The same kind of error is coming for TextBox to Shape

Can you help me?

Thanks

madhu

Hi Madhu,

Which version of Aspose.Cells for Java are you using? Would you please try our released version 1.9.5.x, or just use the latest fix I posted in your another thread: http://www.aspose.com/community/forums/137669/how-to-copy-data-from-excel-to-word/showthread.aspx#137669.