Bug Report T303428
Visible to All Users

Invalid XLS file is generated on creating a document with charts via SpreadsheetControl API

created 9 years ago

When call

chart.Series.Add

and save workbook in xls file.
In Excel 2007 32bit, open result file produce an error:

"File error: data may have been lost"

This problem doesn't occurs if save file in xlsx format.

In the sample, the problem come from line 108 in TestClass1.

Best regards,

Alexandre

Comments (1)
DevExpress Support Team 9 years ago

    Hello Alexandre,
    Thank you for your project. I have successfully reproduced the behavior you described and passed this ticket to our developers for further research.
    Please bear with us. We will notify you as soon as we make any progress.

    However, while researching your scenario, we found the following issues:

    1. The Worksheet names are calculated in your scenario with an apostrophe. You need to correct this point by replacing the following code lines:
    C#
    //string feuilleSourceAxe = correspondance.Groups[1].Value; ................... //string feuilleSource = correspondance.Groups[1].Value;

    with these ones:

    C#
    string feuilleSourceAxe = correspondance.Groups[1].Value.Trim(new char[] { '\'' }); ................. string feuilleSource = correspondance.Groups[1].Value.Trim(new char[] { '\'' });
    1. In your scenario, you are incorrectly using references to document ranges to get corresponding ranges. These references contain information about corresponding worksheets, but are used for inappropriate worksheet instances in your code. The most suitable solution in your scenario is to use the Range.Parse method to calculate correct document ranges. Please refer to the following code:
    C#
    foreach (Tuple<string, string> tupleCourant in listeElement) { //Range rngTitre = feuilleCible.Range[tupleCourant.Item2]; //Range rngArguments = feuilleCible.Range[adresseDonneesAxeX]; //Range rngValeurs = feuilleCible.Range[tupleCourant.Item1]; Range rngTitre = classeur.Range.Parse(tupleCourant.Item2); Range rngArguments = classeur.Range.Parse(adresseDonneesAxeX); Range rngValeurs = classeur.Range.Parse(tupleCourant.Item1); graphiqueCourant.Series.Add(rngTitre, rngArguments, rngValeurs); graphiqueCourant.Series.Add(rngTitre, rngArguments, rngValeurs); }

    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.

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

        Hi Alexandre,
        If everything goes according to plan, the next minor version 15.1.8 will be introduced in the beginning of November 2015. Please stay tuned to our announcements.

        AR AR
        Alexandre Richonnier 9 years ago

          Ok,
          Then, to have this fix include in 15.1.8, do I need to click on "Request hotfix" of this page or not ? (little confuse)
          Your remarks were very useful to developers. To be complete about
          string feuilleSourceAxe = correspondance.Groups[1].Value;
          We don't need to call Trim, because we have sometimes a worksheet name like 'Production of Day' , and space need quote.
          Anyway, thanks again.
          Alexandre

          DevExpress Support Team 9 years ago

            Alexandre,
            The fix for this issue will be included into the next official version 15.1.8 of our components (which will be introduced in the beginning of November 2015). However, if this is a matter of urgency, you can request an intermediate build which will contain a hotfix for this issue. To request this build, you need to click the "Request hotfix" link on this page.
            This build will be prepared within a couple of days. I also suggest you refer to the following KB article:
            How to request a hotfix

            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.