Aspose.Cells.Examples.CSharp.Articles.ManageChartsAndShapes.DisableTextWrappingForDataLabels.Run C# (CSharp) Method

Run() public static method

public static Run ( ) : void
return void
        public static void Run()
        {
            // ExStart:DisableTextWrappingForDataLabels
            // The path to the documents directory.
            string dataDir = RunExamples.GetDataDir(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType);

            // Load the sample Excel file inside the workbook object
            Workbook workbook = new Workbook(dataDir + "sample.xlsx");

            // Access the first worksheet
            Worksheet worksheet = workbook.Worksheets[0];

            // Access the first chart inside the worksheet
            Chart chart = worksheet.Charts[0];

            // Disable the Text Wrapping of Data Labels in all Series
            chart.NSeries[0].DataLabels.IsTextWrapped = false;
            chart.NSeries[1].DataLabels.IsTextWrapped = false;
            chart.NSeries[2].DataLabels.IsTextWrapped = false;

            // Save the workbook
            workbook.Save(dataDir + "Output_out.xlsx");
            // ExEnd:DisableTextWrappingForDataLabels
        }
    }
DisableTextWrappingForDataLabels