简体   繁体   中英

C# blank screen when create excel workbook

When i click "write" button it open Excel file with workbook and writing on cells without problem. I tried on two computer which have Excel 2007 and 2013 it works correctly.

But another pc which is have Excel 2007, it just start excel only with blank screen(no worksheet) and doesnt start writing on cells.

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");

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM