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

Free Support Forum - aspose.com

3D-Format not showing after convert chart to image

Hi ,

I try to apply 3D-fromat on the chart series, I can see it in the excel file, the format apply correctly, but when I convert the chart to the image, I don’t see the 3D-format anymore?

Here is the code I use to apply 3D format.


'Get the Data Series
Dim ser As Aspose.Cells.Charts.Series = chart.NSeries(0)

'Apply the 3-D formatting
Dim spPr As ShapePropertyCollection = ser.ShapeProperties
Dim fmt3d As Format3D = spPr.Format3D

'Specify Bevel with its height/width
Dim bevel As Bevel = fmt3d.TopBevel
bevel.Type = BevelPresetType.Circle
bevel.Height = 2
bevel.Width = 5

'Specify Surface material type
fmt3d.SurfaceMaterialType = PresetMaterialType.WarmMatte

'Specify surface lighting type
fmt3d.SurfaceLightingType = LightRigType.ThreePoint

'Specify lighting angle
fmt3d.LightingAngle = 20

'Specify Series background/foreground and line color
ser.Area.BackgroundColor = Color.Maroon
ser.Area.ForegroundColor = Color.Maroon
ser.Border.Color = Color.Maroon

chart.ToImage().Save(“3d_format.jpg”)

Thanks,
Wei

Hi Wei,

Thanks for using Aspose.Cells.

Please download and try the latest version: Aspose.Cells
for .NET v8.1.2.1
and see if it makes any difference and resolve your issue.

If your issue persists, then please provide us your runnable sample project/code replicating this issue with the latest version. It will be helpful if you could also provide us your expected output xls/xlsx file so that we could investigate this issue more precisely at our end.

Hi

I have tried the latest version, the problem still exists.

I upload the Excel output workbook and the converted chart image, you can see the 3D-format doesn’t show up in the image.

here is the code:

’ The path to the documents directory.
Dim dataDir As String = Path.GetFullPath("…/…/…/Data/")

’ Create directory if it is not already present.
Dim IsExists As Boolean = System.IO.Directory.Exists(dataDir)
If (Not IsExists) Then
System.IO.Directory.CreateDirectory(dataDir)
End If
Dim book As New Workbook()

'Add a Data Worksheet
Dim dataSheet As Worksheet = book.Worksheets.Add(“DataSheet”)

'Add Chart Worksheet
Dim sheet As Worksheet = book.Worksheets.Add(“MyChart”)

'Put some values into the cells in the data worksheet
dataSheet.Cells(“B1”).PutValue(1)
dataSheet.Cells(“B2”).PutValue(2)
dataSheet.Cells(“B3”).PutValue(3)
dataSheet.Cells(“A1”).PutValue(“A”)
dataSheet.Cells(“A2”).PutValue(“B”)
dataSheet.Cells(“A3”).PutValue(“C”)


'Define the Chart Collection
Dim charts As ChartCollection = sheet.Charts
'Add a Column chart to the Chart Worksheet
Dim chartSheetIdx As Integer = charts.Add(ChartType.Column, 5, 0, 25, 15)

'Get the newly added Chart
Dim chart As Aspose.Cells.Charts.Chart = book.Worksheets(2).Charts(0)

'Set the background/foreground color for PlotArea/ChartArea
chart.PlotArea.Area.BackgroundColor = Color.White
chart.ChartArea.Area.BackgroundColor = Color.White
chart.PlotArea.Area.ForegroundColor = Color.White
chart.ChartArea.Area.ForegroundColor = Color.White

'Hide the Legend
chart.ShowLegend = False

'Add Data Series for the Chart
chart.NSeries.Add(“DataSheet!B1:B3”, True)
'Specify the Category Data
chart.NSeries.CategoryData = “DataSheet!A1:A3”

'Get the Data Series
Dim ser As Aspose.Cells.Charts.Series = chart.NSeries(0)

'Apply the 3-D formatting
Dim spPr As ShapePropertyCollection = ser.ShapeProperties
Dim fmt3d As Format3D = spPr.Format3D

'Specify Bevel with its height/width
Dim bevel As Bevel = fmt3d.TopBevel
bevel.Type = BevelPresetType.Circle
bevel.Height = 2
bevel.Width = 5

'Specify Surface material type
fmt3d.SurfaceMaterialType = PresetMaterialType.WarmMatte

'Specify surface lighting type
fmt3d.SurfaceLightingType = LightRigType.ThreePoint

'Specify lighting angle
fmt3d.LightingAngle = 20

'Specify Series background/foreground and line color
ser.Area.BackgroundColor = Color.Maroon
ser.Area.ForegroundColor = Color.Maroon
ser.Border.Color = Color.Maroon

'Save the Excel file
book.Save(dataDir & “3d_format.xlsx”)

chart.ToImage().Save(dataDir & “3d_format.jpg”)


Please let me know if you have any question.

Thanks,
Wei

Hi Wei,

Thanks for your sample code and using Aspose.Cells.

We were able to observe this issue after running your sample code using the latest version: Aspose.Cells
for .NET v8.1.2.1
. 3D-Format showing fine in the output xlsx file but when the chart is converted to image, it does not show up.

We have logged this issue in our database for investigation. We will look into it and fix this issue. Once, the issue is resolved or we have some other update for you, we will let you know asap.

This issue has been logged as CELLSNET-42867.

I have attached the screenshot showing the expected and actual chart image for a reference.

Thanks for the update.

And also the shadow and glow affect are also not working when convert to image, could you please log them as well?

'shadow

chart.NSeries(0).Border.IsVisible = True
chart.NSeries(0).Border.Color = System.Drawing.Color.White
'chart.NSeries(0).Border.Weight = Drawing.WeightType.SingleLine
'chart.NSeries(0).Border.Transparency = 0.5

chart.NSeries(0).Shadow = True
Dim shpt As Aspose.Cells.Drawing.ShapePropertyCollection = chart.NSeries(0).ShapeProperties

Dim shadowEffect As Aspose.Cells.Drawing.ShadowEffect = shpt.ShadowEffect
Dim cellcolor As CellsColor = book.CreateCellsColor()
cellcolor.Color = System.Drawing.Color.Yellow

shadowEffect.PresetType = PresetShadowType.OffsetBottom
shadowEffect.Color = cellcolor
shadowEffect.Transparency = 0.6
shadowEffect.Size = 1
shadowEffect.Blur = 26
shadowEffect.Angle = 90
shadowEffect.Distance = 5

'glow
Dim glowEffect As Aspose.Cells.Drawing.GlowEffect = shpt.GlowEffect
cellcolor = book.CreateCellsColor()
cellcolor.Color = System.Drawing.Color.Yellow

glowEffect.CellsColor = cellcolor
glowEffect.Transparency = 0.6
glowEffect.Radius = 18


Thanks,
Wei

Hi Wei,

Thanks for your posting and using Aspose.Cells.

Please create a separate thread for this newer issue. Because if there are multiple issues then each issue will be logged separately in a database.

It help us investigate and fix the issue more precisely. Thanks for your cooperation.

Hi Wei,

Thanks for your using Aspose.Cells.

We have
evaluated this issue and we are afraid, we cannot support support 3d-format for converting chart to image. We have therefore
closed this issue as Won’t Fix in our database.