Retrieving formulas property in Office System in Spanish

R

Rodolfo

Hi everyone:

I'm having the following problem using .NET components
with Office System. I'm using an Add-in in Excel, written
in C#, but I'm having an unexpected behavior when it runs
with Office System in Spanish

In order to avoid language issues, I'm using the property
FormulaR1C1 to retrieve formulas, which I expect to be
always in English (R#C# instead of F#C# which is the
format used in Spanish). When I use VBScript, VBA or VB
6.0, this is correct; but when I use C#, I'm getting the
F#C# format, exactly the same value as when using the
FormulaR1C1Local property

For instance, the following VBScript
Set x = GetObject(, "Excel.Application")
Set y = x.WorkSheets(1)
MsgBox y.Cells
(1,1).FormulaR1C1 //Retur
ns R4C4
MsgBox y.Cells
(1,1).FormulaR1C1Local //Returns
F4C4

But the equivalent code, written in C#
Excel.Application excelApp =
(Excel.Application)
System.Runtime.InteropServices.Marshal.GetActiveObject
("Excel.Application"):
Excel.Worksheet excelApp.Worksheets[1];
Excel.Range x = (Excel.Range)worksheet.Cells
[1,1];
String s = x.FormulaR1C1.ToString
(); //Returns F4C4
String b = x.FormulaR1C1Local.ToString
(); //Returns F4C4


Am I doing something wrong? This is a known issue? How
can I correct it?

Regards

Rodolfo
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top