When you set a value of 80, it is 8000%, as you would expect, but not 8000. 80% is 0.8
This is the way Excel works too: If you write 80 in a cell, then change the format to percent, you will see it changes into 8000%:
Now, what you might be thinking of is when you write "80%" in Excel: In this case, Excel will enter 0.8 into the cell, format is as "%" and so it will display 80%.
But SetCellValue is a little more "dumber" than this: It will enter whatever you tell it to enter, and it won't look at the format. if you enter 80 then it will enter 80 into the cell no matter if the cell has a percent format, a date format or whatever.
If you want a behavior similar to Excel, you can use "SetCellFromString". In the following code, both A1 and A2 will be set to 0.8 and formatted as %:
static void Main(string args)
XlsFile xlsFile = new XlsFile(1, true);
int XF = xlsFile.GetCellFormat(1, 1);
TFlxFormat fmt = xlsFile.GetFormat(XF);
fmt.Format = "0%";
XF = xlsFile.AddFormat(fmt);
xlsFile.SetCellValue(1, 1, 0.8, XF);
xlsFile.SetCellFromString(2, 1, "80%");
But I personally prefer to use SetCellValue when possible. It makes no sense to convert the number to a string so you can use SetCellFromString, and also SetCellFromString is doing "guess" work, trying to guess what you really meant and entering that into the cell. As said SetCellValue is dumber, and it does exactly what you tell it to do. It is a little more work to know what to tell it to do, but you can be sure it won't guess the wrong thing.