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

Free Support Forum - aspose.com

Createstyle() error (I want to select 1 row to change style but it select complete all rows and apply changes) in excel sheet

i am using aspose.total 17.3 version
Below is code:-
Workbook xlsReport = new Workbook(FileFormatType.Excel97To2003);

            Worksheet sheetXls = xlsReport.Worksheets[xlsReport.Worksheets.ActiveSheetIndex];
            sheetXls.Name = "Data";
            Style titleStyle = xlsReport.CreateStyle();
            titleStyle.Font.Size = 10;
            titleStyle.Font.IsBold = true;
            titleStyle.HorizontalAlignment = TextAlignmentType.Left;
            titleStyle.VerticalAlignment = TextAlignmentType.Left;
            titleStyle.ForegroundColor = System.Drawing.Color.Blue;
            titleStyle.Pattern = BackgroundType.Solid;
            Row row1 = xlsReport.Worksheets[0].Cells.Rows[0];

            // Initialize styleflag object.
            StyleFlag flag = new StyleFlag();

            // Set all formatting attributes on.
            flag.All = true;

            // Apply the style (described above)to the range.
            row1.ApplyStyle(titleStyle, flag);

            // Modify the style (described above) and change the font color from red to black.
            titleStyle.Font.Color = System.Drawing.Color.Black;




Thanks for the code segment and details.

Please try our latest version/fix: Aspose.Cells for .NET v20.4.
I tested your code segment using v20.4, it works fine and output file (attached) is ok.

If you still find the issue with v20.4, let us know with details, sample code and output file, we will check it soon.
files1.zip (1.0 KB)

Hi @Amjad_Sahi
Is there any option to do this without version change because i am using version 17.3 and i don’t want to change version.
Please check if possible in version 17.3

Try test it with some data because your output has no data in it


Generally we do not evaluate issues in older versions, neither we include any fixes to older versions. The fixes are based on latest APIs set only. Anyways, you may create a simple console application (runnable) using your older version, zip the project and post us with all the files (input file, output file, etc.). We will check if your code needs some tweaks.