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

Free Support Forum - aspose.com

Using charts from master document

Hi,

I am trying to load charts from master document. Is this feature available?

Regards
Ranko

Hi,

“Load charts from master document” ------ could you explain it in detail, which feature you are talking about and how to implement it in MS Excel, so that we may understand you and answer you accordingly.

Thank you.

Hi Amjad

Master document - a predefined document/template which includes charts.

See code example below. Chart count is 0 but selected sheet has charts.

Regards

Ranko

Here is the code example

Workbook wb = new Workbook();

wb.LoadData(@"Charts.xlsx");

Worksheet ws = wb.Worksheets["Sheet1"];

Charts cs = ws.Charts;

Hi Ranko,

I found the issue in your code. You used LoadData method instead of Open. For your info, if you use LoadData method, the drawing objects, charts, formattings etc would be excluded. So, kindly always use Open() method for your requirement.

e.g

Workbook wb = new Workbook();

wb.Open(@"Charts.xlsx");

Worksheet ws = wb.Worksheets["Sheet1"];

Charts cs = ws.Charts;


Hi Amjad

thanks it works. Charts are loaded.

You say "drawing objects, charts, formattings etc ". Does this includes styles also?

Regards

Ranko

Hi,

Well, yes, your understanding is correct.

Thank you.

Hi Amjad

yes thats true. Styles are loaded.

please consider including following method on styles.

Regards

Ranko

public static class AsposeStyleExtensions

{

public static Style Add(this Styles styles, String name)

{

Style style = styles[styles.Add()];

style.Name = name;

return style;

}

}

Hi,

Well, the Styles.Add() method is already included in the API.

Thank you.