Hello,
we always set the cell FormatString for numbers in international localization "#,##0.00" even if the local/excel localization is different (german in this case). (https://msdn.microsoft.com/en-us/library/bb157877.aspx : the Excel Object Model Always Expects Locale ID 1033)
In Infragistics v10.3 this works fine, with v14.1 its not. it looks like it expects a localized FormatString.
GreetingsKiTs
Thank you for posting in our forum.
Yes you are correct. In Infragistics 14.1 you need to specify localized format string to UltraExcelExporter. In 14.1 the format string is exactly taken over to Excel. Please find attached a small sample solution showing how to set the Excel format string during export.
Please let me know if this is what you are looking for or if I am missing something.
Sincerely,
Milko
Developer Support Engineer
Infragistics, Inc.
www.infragistics.com/support
Hello Milko,
thanks for your answer. I cant download your sample right now, because your server seems to be under maintance; i will try tomorrow.
So that means all our FormatString's wont work anymore; is this change listed as Breaking Change anywhere we didnt saw?
edit: i was able to download it now. ok sure i could do it like that. but we are interested in your philosophy behind it. every control of yours takes international FormatString, like XamNumericEditor, right? MSDN says Excel expects international culture too. How it comes u changed this behaviour, of your previous version, here?
MSDN says:The common language runtime (CLR) automatically passes locale ID 1033 to all methods and properties in the Excel object model that accept locale-sensitive data. There is no way to change this behavior automatically for all calls into the object model. However, you can pass a different locale ID to a specific method by using InvokeMember to call the method and by passing the locale ID to the culture parameter of the method.
So r u explicit doing that, and for what purpose? (In which situation could u probably want/expect localized FormatString's? Managed by User?..)
greetz
Hello Martin,
Thank you for your feedback.
In Infragistics Components 12.1 and 13.2 we have cleared several issues related to numbers exporting. With this changes, the format strings were made culture-aware to be more in line with the behavior of MS Excel. In order to export numbers from UltraGrid to Excel as numbers you need to:
1. Set the Workbook culture to InvariantCulture. You can do this in ExportStarted event of UltraGridExcelExporter.
2. Set the EcxelFormatStr property of your numeric column to the same format as the UltraGrid numeric column is set.
Please note you need to use the same approach if you use XamNumericEditor. Attached I am sending you revised version of my sample solution where I have implement above mentioned steps.
Please let me know if you need any further assistance.
got that, thank you.
So we work through all our applications which are using Excel. I'm interested if / where it was listed as Breaking Change we didnt saw, so we can look for it in future versions.
But if i define a xamNumericEditor in xaml the format is still invariant. (And i hardly expect it to be, please tell me in RED letters if it will change...) same in code-behind, what do u mean with xamNumericEditor?
<igEditors:XamNumericEditor Width="100" Grid.Column="4" Grid.Row="0" IsReadOnly="True" Background="#F0F0F0" Format="#,###0.000 %" Mask="{}{double:-6.3}" Value="{Binding Konditionen}" />
It doesnt care which culture is set for application/system.
GreetingsJoerg
Hello Infragstics-Team,
i think we talk at cross purposes at some point. But i accept that breakting change and work with it.
Thanks for all your responses.
With kind regardsJoerg
Hello Joerg,
If you want exported Excel keeps formatting for different culture on which the file is opened, you should set culture of the workbook to be InvariantCulture (Milko did this in his sample in ExportStarted event e.Workbook.Culture = CultureInfo.InvariantCulture;) and also you should use format strings which are formatted in InvarinatCulture and are compatible with Excel format string. In other words you could use whatever strings you want for your xamNumerikEditor, UltraWinGridColumn and etc. and if you what your Excel to be exported properly you must set its culture to be InvariantCulture and also you should use format strings which are formatted in InvarinatCulture and are compatible with Excel format string, for the corresponding Excel’s column or cell. Exporter does not get the component format string to pass it (and translate it) to the exported Excel. This is because Excel format strings are different from .Net format strings.
“So my last question was @Milko what he meant with XamNumericEditor, as it works as i expected, without culture dependency there” – Milko’s sample generates culture invariant excel format string (“#,##0.00”), which is applied to the UltraGridColumn (in this case .Net and Excel format string are the same) . When he exports that column, he does not need to translate this format string to culture invariant excel format string, since he uses such string for the column. Instead, he just transits this format string to the corresponding column of the exported Excel (see InitializeColumn event of UltraGridExcelExporter). So he has advised you to use same approach (where it is applicable) for other components and particularly for XamNumericEditor, because you’ve asked about XamNumericEditor. Or with other words, if you use format strings which are formatted in InvarinatCulture and are compatible with Excel format string for the component or column which you will export, then you could just transit this string to the corresponding column of the exported Excel. And everything should works fine if the exported workbook is in InvariatntCulture.
About breaking changes you could review them for particular version following the corresponding link form the following list:
http://help.infragistics.com/doc/WinForms/2014.2/CLR4.0/?page=Win_Known_Issues_and_Breaking_Changes.html
Please let me know if you have any further questions.
Hello Zhivko,
i do not have an issue with the XamNumericEditor.
Its about the culture of the format string itself, not the displayed value. I always want to set the formatstring "#,#0.0" (international culture; german cultue formatstring is "#.#0,0").
For excel worksheet in v14.1 u newly have to set the cultured formatstring "#.#0,0". For XamNumericEditor you still have to set "#,#0.0", for both the same displayed output.
(So my last question was @Milko what he meant with XamNumericEditor, as it works as i expected, without culture dependency there.)
And i still would like to know if its listed as breaking change, so we know such for future versions.
Thank you for you post.
I have been looking into it and I am not sure that understand correctly what is the issue that you are having.
I have created a sample application based on your code snippet and bases on what is the current culture of the application, the display text of the XamNumericEditor is changed and depends on the Formant property. I am attaching a screenshot of the application when the Current Culture is bg and us and as you can see the formatting is different.
Would you please provide me with more detailed description of the issue that you are having and what is the result that you are looking for?
Looking forward to hearing from you.