none
Excel Language problem when using .Net Interop RRS feed

  • Question

  • Probably everyone already ran into this problem: the regional settings are not the same as excel language .. and you get an error like

    "To support the Dutch (Belgium) language, install the Language Package for your version of Microsoft Office."

    Now, I don't want to run Excel in Dutch (I just don't know calc formula's in Dutch ...), and i don't want to run my Windows in English.  So I don't want to change any general setup.

    But I do want to export to excel using .Net Interop. 

    I tried to:

    - Change the cultrureinfo of the current thread, but this doesn't seem to do anything.

    - change the language by the GLOBALLANGUAGE(1033) statement in C/AL

    is there anything else that I can try?


    Eric Wauters
    • Moved by Scott E. Wright Monday, May 9, 2011 8:34 PM Outside Dynamics NAV scope (From:Dynamics NAV)
    Wednesday, May 4, 2011 9:13 AM

Answers

  • Hi Eric,

    Thank you for posting.

    Please refer to this similar thread to see whether it help you:http://www.netframeworkdev.com/common-language-runtime/excel-interop-gt-globalizationcultureinfo-does-not-work-37279.shtml

    How did you set the cultureinfo to the current thread? Could you show us some code snippet? In addition, what's the version of your project?

    Try to use late bind to set the cultureInfo as follows:

     

    Dim oApp As New Excel.Application()
    oApp.Visible = True
    oApp.UserControl = True
    Dim oBooks As Object = oApp.Workbooks
    Dim ci As System.Globalization.CultureInfo = New System.Globalization.CultureInfo("en-US")
    oBooks.GetType().InvokeMember("Add", Reflection.BindingFlags.InvokeMethod, Nothing, oBooks, Nothing, ci)
    
    

     

    Hope this can help you and feel free to follow up.

    Best Regards,


    Bruce Song [MSFT]
    MSDN Community Support | Feedback to us
    Get or Request Code Sample from Microsoft
    Please remember to mark the replies as answers if they help and unmark them if they provide no help.



    • Marked as answer by Bruce Song Monday, May 23, 2011 9:52 AM
    Wednesday, May 11, 2011 7:35 AM

All replies

  • Hi Eric,

    Thank you for posting in the Microsoft Forums!

    I think this is more a question for the VS for Office Components team based the the error, it isn't an issue with calling into Office. I'm going to move this post over to another queue.

    Kindest Regards,
     
    Scott Wright
     
    Partner Online Technical Community
    -----------------------------------------------------------------------------------------
    We hope you get value from our new forums platform! Tell us what you think:
    http://social.microsoft.com/Forums/en-US/partnerfdbk/threads
    ------------------------------------------------------------------------------------------
    This posting is provided "AS IS" with no warranties, and confers no rights

    Monday, May 9, 2011 8:29 PM
  • Hi Eric,

    Thank you for posting.

    Please refer to this similar thread to see whether it help you:http://www.netframeworkdev.com/common-language-runtime/excel-interop-gt-globalizationcultureinfo-does-not-work-37279.shtml

    How did you set the cultureinfo to the current thread? Could you show us some code snippet? In addition, what's the version of your project?

    Try to use late bind to set the cultureInfo as follows:

     

    Dim oApp As New Excel.Application()
    oApp.Visible = True
    oApp.UserControl = True
    Dim oBooks As Object = oApp.Workbooks
    Dim ci As System.Globalization.CultureInfo = New System.Globalization.CultureInfo("en-US")
    oBooks.GetType().InvokeMember("Add", Reflection.BindingFlags.InvokeMethod, Nothing, oBooks, Nothing, ci)
    
    

     

    Hope this can help you and feel free to follow up.

    Best Regards,


    Bruce Song [MSFT]
    MSDN Community Support | Feedback to us
    Get or Request Code Sample from Microsoft
    Please remember to mark the replies as answers if they help and unmark them if they provide no help.



    • Marked as answer by Bruce Song Monday, May 23, 2011 9:52 AM
    Wednesday, May 11, 2011 7:35 AM
  • Hi Eric,

    Have you figured out your problem yet, and does the suggestion help you? If you still have any concern on the thread, feel free to follow up.

    Best Regards,




    Bruce Song [MSFT]
    MSDN Community Support | Feedback to us
    Get or Request Code Sample from Microsoft
    Please remember to mark the replies as answers if they help and unmark them if they provide no help.

    Monday, May 16, 2011 7:57 AM