Getting chart from xls by name

Hi,

We are trying to find a solution for our server side service for filling word documents with data from xls documents and are evaluating aspose .net libraries to check if they offer functionalities we need for that.

We have two concerns at the moment:
- We need to be able to get chart from xls using its name (e.g. such as “Chart 1”, “Chart 5” in second worksheet in attached document). Problem is we don’t seem to be able to fetch such a chart using aspose.cells as each of those charts has different name than that we have set in excel (when going through Charts they have names such as Chart 106497, Chart 106498, etc.). Is there any way to be able to fetch chart using those names that we can use in excel?
- additional concern we have is ability to copy named ranges from xls to word tables. Is there some possibility to e.g. copy range/array of cells to clipboard, or any other way for performing task of creating table in word from area in excel that would give effect similar to copy - paste in office applications, other then manually building this table in word by parsing range object?

Regards,
Leszek

Hi Leszek,

Thanks for providing us the template file with some details.

1) Which version of the component you are using? Please try the attached version. I have tested with it using the following codes and it works fine. I obtain chart names such as "Chart 106497", "Chart 106498", etc.

Workbook wb1 = new Workbook();

wb1.Open("f:\\test\\test_or.xls");

Charts charts = wb1.Worksheets["1"].Charts;

foreach (Chart chart in charts)

{

MessageBox.Show(chart.Name);

}

2) Well, you may fill an array using Cells.ExportArray() or can fill a datatable using Cells.ExportDataTable() methods based on the data range and then extract that array/datatable in word document if it suits your need.

Some other alternatives can be:

1) use the workbook (sheet) as an ole object using Aspose.Words API to embed it in word document.

2) Use worksheet2Image feature provided by Aspose.Cells for .NET, but it will give you a static picture for your sheet that you may insert it into word document. For reference, please see: http://www.aspose.com/documentation/file-format-components/aspose.cells-for-.net-and-java/converting-worksheet-to-image.html

Thank you.

Thanks for quick answer

As to the first question the thing is i get the same names for those charts through aspose.cells that you mentioned, but if you open this document in excel, and then navigate to worksheet with charts and type e.g. “Chart 1”, “Chart 5” or “Chart 7” (those were names that those charts were given using ms excel) in box for navigating though worksheet you get one of the charts selected. But in case of using aspose.cells it has totally different name, such as “Chart 106497” you mentioned, which seems not related in any way to the one that has been originally, typed which makes it virtually impossible to select correct chart with your library if that is the case.

So my question is is that name that is available in ms office excel in some way retrieved and accessible in your library?

Regards,
Leszek

Hi,

Thank you for considering Aspose.

We have found your mentioned issue after an initial test. We will further look into it and get back to you soon.

Thank You & Best Regards,

Hi Leszek,

Thank you for considering Aspose.

Please try the attached latest version of Aspose.Cells. We have fixed your mentioned issue.

Thank You & Best Regards,

The issues you have found earlier (filed as 10158) have been fixed in this update.


This message was posted using Notification2Forum from Downloads module by aspose.notifier.

Note: Just for your knowledge. In the new release v4.8.0, we have merged Aspose.Grid suite to Aspose.Cells for .NET msi installer as Aspose.Grid would be no longer offered as a separate product now. You need to install the installer (uninstall older one first if you have) and use only Aspose.Cells.dll library in your project for your need. You may also take advantage using Aspose.Cells Grid suite though.

I wanted to know if there is anyway to set the cell index start from (0,0) intead of (1,1). Actually i am converting an application that uses Microsoft Excel to ASPOSE. Since microsoft excels default cell index is (0,0) means row0 and column0 as the first cell on the worksheet where as Aspose is (1,1). Is there a way that we can force Aspose to start at 0,0 instead of 1,1 so my conversion would be pretty easy instead of changing the rows and columns position for each cell.

Let me know if this is possible at all?

Ashokpas

Hi,

Well, the indexes for Rows & Columns for Cells[int Row,int Column] starts with zero i.e. A1=Cells[0,0]. In all Aspose.Cells APIs, the index for rows & columns are zero based. If you are facing any problem, please share your code and template file here, we will check it soon.

Thank You & Best Regards,