Free Support Forum - aspose.com

Can't set BarFillType for Excel97To2003


#1

Hi all, I’m using Data Bar and set BarFillType = DataBarFillType.Solid; but when save as Excel97To2003, it does not working.
How to fix it? :frowning:

Thanks and regard


#2

@DungLT,

Please share your sample application (runnable) with us for our testing. We will reproduce the problem and provide our feedback after analysis.


#3

Here is my example, pls check for me.
//Instantiating a Workbook object
Workbook workbook = new Workbook();
Worksheet sheet = workbook.Worksheets[0];
//Adds an empty conditional formatting
int index = sheet.ConditionalFormattings.Add();
var fcs = sheet.ConditionalFormattings[index];
//Sets the conditional format range.
CellArea ca = new CellArea();

        ca.StartRow = 0;
        ca.EndRow = 2;
        ca.StartColumn = 0;
        ca.EndColumn = 0;
        fcs.AddArea(ca);

        //Adds condition.
        int idx = fcs.AddCondition(FormatConditionType.DataBar);

        fcs.AddArea(ca);

        FormatCondition cond = fcs[idx];
        //Get Databar
        DataBar dataBar = cond.DataBar;

        //Set Databar properties
        dataBar.MinCfvo.Type = FormatConditionValueType.Number;
        dataBar.MaxCfvo.Type = FormatConditionValueType.Number;

        dataBar.MinCfvo.Value = 0;
        dataBar.MaxCfvo.Value = 100;
        dataBar.MinLength = 0;
        dataBar.MaxLength = 100;

        //dataBar.ShowValue = true;

        dataBar.BarFillType = DataBarFillType.Solid;

        //Put Cell Values
        Aspose.Cells.Cell cell1 = sheet.Cells["A1"];
        cell1.PutValue(10);
        Aspose.Cells.Cell cell2 = sheet.Cells["A2"];
        cell2.PutValue(100);
        Aspose.Cells.Cell cell3 = sheet.Cells["A3"];

        cell3.PutValue(99);

        //Saving the Excel file
        workbook.Save("D:\\book1.xls", SaveFormat.Excel97To2003);

#4

@DungLT,

I have tried your sample code with latest version Aspose.Cells for .NET 18.12.7 given below:
Aspose.Cells18.12.7 For .Net2_AuthenticodeSigned.Zip (4.7 MB)
Aspose.Cells18.12.7 For .Net4.0.Zip (4.7 MB)

It creates proper output as attached here:
book1.zip (915 Bytes)
Capture.JPG (2.7 KB)

If it is not as per your requirement, please provide us the expected output created by Excel. It will help us to observe the requirement and provide assistance.


#5

Thanks for your support,
I see Excel 2003 does not support Solid fill type.

Thanks and regard


#6

@DungLT,

You are welcome.