No data is available for encoding 936. For information on defining a custom encoding, see the docume

Posted 棉晗榜

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了No data is available for encoding 936. For information on defining a custom encoding, see the docume相关的知识,希望对你有一定的参考价值。

异常描述,使用Aspose.Cells导出电子表格文件异常:
No data is available for encoding 936. For information on defining a custom encoding, see the documentation for the Encoding.RegisterProvider method.

解决办法:

添加如下代码

//注册编码提供程序 
System.Text.Encoding.RegisterProvider(System.Text.CodePagesEncodingProvider.Instance);

完整代码参考:

public static void ExportExcel(List<List<object>> data, string outPath)

	//注册编码提供程序
	System.Text.Encoding.RegisterProvider(System.Text.CodePagesEncodingProvider.Instance);

	Aspose.Cells.Workbook wb = new Aspose.Cells.Workbook();
	Aspose.Cells.Worksheet sheet = wb.Worksheets[0];
	Aspose.Cells.Cells cells = sheet.Cells;
	Aspose.Cells.Style style = wb.Styles[wb.Styles.Add()];
	//style.Font.Name = "宋体";
	style.Font.Size = 12;
	cells.ApplyStyle(style, new StyleFlag()  All = true );
	int cols = data[0].Count;

	//标题样式
	Aspose.Cells.Style styleTitle = wb.Styles[wb.Styles.Add()];
	styleTitle.Font.IsBold = true;
	styleTitle.Font.Size = 12;
	Aspose.Cells.Range range = cells.CreateRange(0, 0, 1, cols);
	range.ApplyStyle(styleTitle, new StyleFlag()  All = true );

	object[,] dataArr2 = new object[data.Count, cols];
	for (int n = 0; n < data.Count; n++)
	
		var rowLine = data[n];
		for (int j = 0; j < rowLine.Count; j++)
		
			dataArr2[n, j] = rowLine[j];
		
	

	cells.ImportTwoDimensionArray(dataArr2, 0, 0);

以上是关于No data is available for encoding 936. For information on defining a custom encoding, see the docume的主要内容,如果未能解决你的问题,请参考以下文章

There is no source code available for the current location

The POM for ... is missing, no dependency information available

nested exception is java.lang.IllegalStateException: No instances available for HELLO-SERVICE] with

The POM for com.qingmu:entity:jar:1.0.0-SNAPSHOT is missing, no dependency information available(示例代

The POM for XXX:jar:${com.ld.base.service.version} is missing, no dependency information available(示

RuntimeError:CUDA error:no kernel image is available for execution on the device报错解决(亲测)