[英]C# blank screen when create excel workbook
When i click "write" button it open Excel file with workbook and writing on cells without problem. 当我单击“写入”按钮时,它会打开带有工作簿的Excel文件,并在单元格上写入而不会出现问题。 I tried on two computer which have Excel 2007 and 2013 it works correctly.
我尝试在两台具有Excel 2007和2013的计算机上正常运行。
But another pc which is have Excel 2007, it just start excel only with blank screen(no worksheet) and doesnt start writing on cells. 但是另一台装有Excel 2007的电脑,它只能在空白屏幕(没有工作表)下启动excel,并且不会开始在单元格上书写。
Here is my code 这是我的代码
class CreateExcelDoc
{
private Excel.Application app = null;
private Excel.Workbook workbook = null;
private Excel.Worksheet worksheet = null;
private Excel.Range workSheet_range = null;
public CreateExcelDoc()
{
createDoc();
}
public void createDoc()
{
System.Globalization.CultureInfo oldCI = System.Threading.Thread.CurrentThread.CurrentCulture;
app = new Excel.Application();
app.Visible = true;
workbook = app.Workbooks.Add(1);
worksheet = (Excel.Worksheet)workbook.Sheets[1];
}
仅“ en-US”支持Excel Interop
Thread.CurrentThread.CurrentCulture = new CultureInfo("en-US");
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.