Free Support Forum - aspose.com

Why Apose.Cells changed the format of data labels in chart?

I updated a Powerpoint slide with an embedded Excel chart. I updated the Chart using Aspose.Cells' Smart Marker feature. The problem is that it appears that Aspose changed the format of the data labels. I am attaching three slides (original one, one after update, templatewith smart markers) for this posting so you can see the difference.

The label on the top of each blue bar shows the height or value of each blue bar. After updating with current data, Aspose changed the background color the label for the blue bars so you see a little black rectangle in the background of each label. Why is this?
I am expecting the format to be just the same as the original. Note that my code does not touch any formating at all, it just calls Aspose.Cells.WorkbookDesigner to inject data into the smart markers.

My code is like this:

Dim dsBenchmarkReturn As DataSet = Me.getPeBenchmarkReturnData()
Dim dtBmkReturn As DataTable = dsBenchmarkReturn.tables(0)
Dim chartShape As Shape = slide.FindShape("ComparisonWithBenchmarkChart")
Dim oof As OleObjectFrame = CType(chartShape, OleObjectFrame)
Dim mstream As MemoryStream = New MemoryStream(oof.ObjectData)
Dim designer As Aspose.Cells.WorkbookDesigner = New Aspose.Cells.WorkbookDesigner()
designer.Open(mstream)
designer.SetDataSource(dtBmkReturn)
designer.SetDataSource("SP500", SP500)
designer.SetDataSource("MSCI", MSCI)
designer.Process()
oof.ObjectData = designer.Workbook.SaveToStream().ToArray()


To make sure it is not Aspose.Slides that is causing the problem, I write out the designer workbook to an excel file.
The excel output file indeeds has the background of data labels changed to black.
This is how I dumped out the excel file:
Dim ms As MemoryStream = designer.Workbook.SaveToStream()
Dim fout As FileStream = New FileStream("c:\Temp\out.xls", FileMode.OpenOrCreate, FileAccess.Write)
fout.Write(ms.ToArray(), 0, CInt(ms.Length()))
fout.Close()

To summarize, I do not want Aspose.Cells to change the format of the data labels. How can fix this?

I updated the code to add a line near the end to force the background of the DataLabels to be transparent (in attempt to fix the problem). However, only two of the four labels got changed to transparent, the other two labels still got the black background. This is baffling. I am attaching the result slide for you to see.
Something is fishy here. Even though I force the background to transparent, NOT all the data labels' background got changed to transparent. Please see the labels near the top of the blue bars. I should not have to set the background of the data labels in the first place.

This is how I try to force the background of the datalabels to transparent:

Dim oof As OleObjectFrame = CType(chartShape, OleObjectFrame)
Dim mstream As MemoryStream = New MemoryStream(oof.ObjectData)
Dim designer As Aspose.Cells.WorkbookDesigner = New Aspose.Cells.WorkbookDesigner()
designer.Open(mstream)
designer.SetDataSource(dtBmkReturn) ' return data for Venture Econ. benchmark
designer.SetDataSource("SP500", SP500)
designer.SetDataSource("MSCI", MSCI)
designer.Process()
designer.Workbook.Worksheets(0).Charts(0).NSeries(0) .DataLabels.Background = Aspose.Cells.BackgroundMode.Transparent
oof.ObjectData = designer.Workbook.SaveToStream().ToArray()

Hi,

Thanks for providing us the detals with sample templates.

Which version of Aspose.Cells for .NET you are using. Could you try the lastest version if it works fine: http://www.aspose.com/community/files/51/file-format-components/aspose.cells/entry133353.aspx

If you still find the issue, kindly create a sample test project, zip it (with all the files) and post us here to reproduce the issue, we will check it soon.

Thank you.

I right clicked on the Aspose.Cells.dll and select Properties => Version Tab

It tells me the Assembly Version is 4.4.3.1

I just upgraded to version 4.5.0.0 but I still observed the same problem described above.

Hi,

We will figure out your issue soon.

Thank you.

Hi,

We have fixed the bug of reading chart and setting background. Could you try the fix (Aspose.Cells version 4.5.0.3) posted in the thread: http://www.aspose.com/community/forums/thread/134097/support-for-replace-function-in-.net.aspx

Thank you.

Version 4.5.0.3 fixes the problem. Thanks everyone.