作者:乔山办公网日期:
返回目录:excel表格制作
using (ms = new MemoryStream()) //这里至少要设置文件名啊
Your problem is the mis-match of these two lines
XSSFWorkbook workbook = new XSSFWorkbook();
and
response.setContentType("application/vnd.ms-excel");
If you really want to generate a .xls older-style Excel workbook, you need to change the first line to be HSSFWorkbook rather than XSSFWorkbook
If you do mean to generate a .xlsx Excel workbook, then the content type on the second line needs to be the correct .xlsx one, which would be:
response.setContentType("application/vnd.openxmlformats-officedocument.spreadsheetml.sheet"
推荐下面免费的抄方法试试:
方法一:使用虚拟打印机pdf factory即可,而且其他格式文件只要是能够打印,选择这个虚拟打印机,都可以做成PDF文件,很简单实用;袭
方法二:使用专门的转换软件,把文件转成PDF文件;
方法三:用其他虚拟打印机转成PDF文件。
方法四:用WPS本身自带的转换功能zhidao转成PDF文件。
字符百编解度码的问知题吧。
这样道试试内:
string name = Encoding.UTF8.GetString(Encoding.Default.GetBytes("姓名容"));
headerRow.CreateCell(0, CellType.String).SetCellValue(name);