//Adding a numeric value to "A2" cell string a = "100"; worksheet.Cells["A2"].PutValue(a, true); --主要是这个,增加一个参数,一般不会用到 //Getting the Style of the A2 Cell style = worksheet.Cells["A2"].GetStyle(); //Setting the display format to number 9 to show value as percentage style.Number = 1; -- 这个Number设置 官方有API可以看到 相应的设置 //Applying the style to the A2 cell worksheet.Cells["A2"].SetStyle(style);
官方有例子 下下来看了的 貌似是DLL版本问题 没搞懂那里设置的
这样一个一个去设置,,,不可行....
都试过了 有个style.Custom = cells[i, 2].StringValue; 这个是转化string http://www.aspose.com/docs/display/cellsnet/Importing+Data+to+Worksheets
上面是官方的例子 不知道弄的数据出来 还有DLL的版本也不同了
做个几号,方便以后人用 能解决
//Adding a numeric value to "A2" cell
string a = "100";
worksheet.Cells["A2"].PutValue(a, true); --主要是这个,增加一个参数,一般不会用到 //Getting the Style of the A2 Cell
style = worksheet.Cells["A2"].GetStyle(); //Setting the display format to number 9 to show value as percentage
style.Number = 1; -- 这个Number设置 官方有API可以看到 相应的设置 //Applying the style to the A2 cell
worksheet.Cells["A2"].SetStyle(style);
还有 就是 mybook.Worksheets[0].Cells[1, 3].Type这个type 是不是只读的..
和背景 字体什么的没关系 这个可以另外设置还有你检查下DLL的版本 网上下的有可能比较老
到官方应该是最新 的7.几版本