Bug Report T294882
Visible to All Users

Documents whose CustomFunctionExportMode property is set to "CalculatedValue" are saved incorrectly

created 9 years ago

Hello,

This problem breaks the features used by our customers.
Run the attached project, in first cell type =SPHEREMASS(5,5) and save it to file.
Try to open that file. It generates null object reference.
Please correct it or provide a workaround .

Thank you,

Oleg

Comments (3)
DevExpress Support Team 9 years ago

    Hi,

    We have successfully reproduced the behavior you described and passed this ticket to our developers for further research.
    As a workaround, I suggest you set the CustomFunctionExportMode  property to "Function" to avoid the problem.
    Please bear with us. We will notify you as soon as we make any progress.

      We cannot use "Function", because we need to translate custom functions to values because our custom functions are not supported on receiving side. We really need the workaround because it affects customers now. Could you please provide code snippet which replaces functions with their values cell by cell? We plan to use something like that as a workaround, it will run before we same the workbook:
      workbook.BeginUpdate();
                 workbook.DocumentSettings.Calculation.Mode = CalculationMode.Manual;
                 foreach (var cell in from worksheet in workbook.Worksheets
                                      select worksheet.GetExistingCells()
                                          into cells
                                          from cell in cells
                                          where cell.HasFormula
                                          select cell)
                 {
                     cell.CopyFrom(cell, PasteSpecial.Values);
                 }
                 workbook.EndUpdate();
      If you can give us the code sample that would be great.

      DevExpress Support Team 9 years ago

        Hi,

        As for the workaround you require, you can use the following code block:

        C#
        workbook.BeginUpdate(); try { foreach(Worksheet sheet in workbook.Worksheets) { foreach(Cell cell in sheet.GetExistingCells()) { if(cell.HasFormula) cell.Value = cell.Value; } } } finally { workbook.EndUpdate(); }

        If you need further assistance, let me know.

        Answers approved by DevExpress Support

        created 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.

          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.