Syncfusion.XlsIO.Base
Example 


ScalingMode Property (IChartToImageConverter)

It represents the chart image Scaling. Default value is Normal.
Syntax
'Declaration
 
Property ScalingMode As ScalingMode
'Usage
 
Dim instance As IChartToImageConverter
Dim value As ScalingMode
 
instance.ScalingMode = value
 
value = instance.ScalingMode
ScalingMode ScalingMode {get; set;}
Remarks
To know more about chart to image conversion refer this link.
Example
The following code illustrates how to set scaling mode for IChartToImageConverter object.
using Syncfusion.ExcelChartToImageConverter;
using Syncfusion.XlsIO;
using System.Drawing;
using System.IO;
            
class Program
{
    static void Main(string[] args)
    {
        using (ExcelEngine excelEngine = new ExcelEngine())
        {
            //Create worksheet
            IApplication application = excelEngine.Excel;
            application.DefaultVersion = ExcelVersion.Excel2013;
            IWorkbook workbook = application.Workbooks.Create(1);
            IWorksheet sheet = workbook.Worksheets[0];
            
            // Initializing the chart to image converter object
            application.ChartToImageConverter = new ChartToImageConverter();
            
            //Set the chart to image converter Scaling mode to best
            application.ChartToImageConverter.ScalingMode = ScalingMode.Best;
            
            //Add data
            sheet.Range["A1"].Text = "Jan";
            sheet.Range["B1"].Text = "Feb";
            sheet.Range["C1"].Text = "Mar";
            sheet.Range["A2"].Value = "10";
            sheet.Range["B2"].Value = "20";
            sheet.Range["C2"].Value = "30";
            sheet.Range["A3"].Value = "15";
            sheet.Range["B3"].Value = "25";
            sheet.Range["C3"].Value = "35";
            
            //Create chart
            IChart chart = sheet.Charts.Add();
            
            //Set range
            chart.DataRange = sheet.Range["A1:C3"];
            
            //Set chart type
            chart.ChartType = ExcelChartType.Column_Clustered;
            
            //Initalizing the new stream
            MemoryStream imageStream = new MemoryStream();
            
            //Convert the chart to image stream
            chart.SaveAsImage(imageStream);
            
            //Saving the image stream to a file
            Image bitmap = Image.FromStream(imageStream);
            bitmap.Save("image.png");
            
            //Dispose            
            workbook.Close();
        }
    }
}
AssemblyVersion

Syncfusion.XlsIO.Base: 16.4460.0.52

See Also