1
votes

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];          
    }
1
What version of the Excel Interop are you using (Inside References)? What culture is that machine set at? Excel Interop is only supported with "en-US"Gerhard Powell
i use version 14.0.0.0 of interopt. And machine culture which is problem is en-US.Koray
I use 12 and I have not find a reason to go to 14...Gerhard Powell
After i added this code below solved the problem. Thanks. Thread.CurrentThread.CurrentCulture = new CultureInfo("en-US");Koray

1 Answers

0
votes

Excel Interop is only supported with "en-US"

Thread.CurrentThread.CurrentCulture = new CultureInfo("en-US");