Bug Report T316297
Visible to All Users

GridControl exports a date to Excel incorrectly when a cell is customized in the XlsxExportOptionsEx.CustomizeCell event handler

created 9 years ago

Hi,

i export data from a DataGrid to an excel file, with TableView.ExportToXlsx(string filePath). Date fields are exported OK.

In some szenarios i modify the column sequence befor exporting. Text fields are exported without line breaks, that is OK. But date fields are now exported as Text (for example 40932 as 24.01.2012). I tried a lot, but nothing helps. Can  you help?
// Geändert durch [CHANGE_USER]  (NUR LESEND)
GridControlMain.Columns["CHANGE_USER"].Header = PropertyClass.CustomsData_Column_O;
GridControlMain.Columns["CHANGE_USER"].Visible = true;
GridControlMain.Columns["CHANGE_USER"].VisibleIndex = 36;
GridControlMain.Columns["CHANGE_USER"].PrintCellStyle = (System.Windows.Style)Application.Current.Resources["noLineBreaksText"];
GridControlMain.Columns["CHANGE_USER"].GroupIndex = -1;
// Geändert am [CHANGE_DATE]  (NUR LESEND)
GridControlMain.Columns["CHANGE_DATE"].Header = PropertyClass.CustomsData_Column_O;
GridControlMain.Columns["CHANGE_DATE"].Visible = true;
GridControlMain.Columns["CHANGE_DATE"].VisibleIndex = 37;
//GridControlMain.Columns["CHANGE_DATE"].PrintCellStyle = (System.Windows.Style)Application.Current.Resources["noLineBreaksText"];
GridControlMain.Columns["CHANGE_DATE"].GroupIndex = -1;

<Style x:Key="noLineBreaksText" TargetType="dxe:TextEdit" BasedOn="{StaticResource {dxgt:TableViewThemeKey ResourceKey=DefaultPrintCellStyle}}">
    <Setter Property="IsPrintingMode" Value="True" />
    <Setter Property="dxp:ExportSettings.TargetType" Value="Text" />
     <!-- <Setter Property="dxp:TextExportSettings.Text" Value="{Binding Value, Converter={local:RemoveLineBreaksConverter}}" /> -->
     <Setter Property="MaxHeight" Value="22" />
</Style>

Thank you very much
Andreas

Show previous comments (6)
DevExpress Support Team 9 years ago

    Hi Andreas,
    I've successfully reproduced the issue on my side and passed this ticket to our developers for further research. We'll update this thread as soon as we make any progress.
    Regards,
    Nadya

      Hi Nadya, thank you very much. Can you send me a small sample ExportToXlsx method with ExportType.DataAware and WYSIWYG to see the difference?

      DevExpress Support Team 9 years ago

        Hi Andreas,
        Sure. I've modified your sample.You can find it in attachment.
        Feel free to contact us if you need further assistance.
        Regards,
        Nadya

        Answers approved by DevExpress Support

        created 9 years ago (modified 9 years ago)

        We have fixed the issue described in this ticket and will include the fix in our next maintenance update. To apply this solution before the official update, request a hotfix by clicking the corresponding link for product versions you require.

        Note: Hotfixes may be unavailable for beta versions and updates that are about to be released.

          Comments (1)

            It works. Thank you very much.

            Disclaimer: The information provided on DevExpress.com and affiliated web properties (including the DevExpress Support Center) is provided "as is" without warranty of any kind. Developer Express Inc disclaims all warranties, either express or implied, including the warranties of merchantability and fitness for a particular purpose. Please refer to the DevExpress.com Website Terms of Use for more information in this regard.

            Confidential Information: Developer Express Inc does not wish to receive, will not act to procure, nor will it solicit, confidential or proprietary materials and information from you through the DevExpress Support Center or its web properties. Any and all materials or information divulged during chats, email communications, online discussions, Support Center tickets, or made available to Developer Express Inc in any manner will be deemed NOT to be confidential by Developer Express Inc. Please refer to the DevExpress.com Website Terms of Use for more information in this regard.