Announcement

Collapse
No announcement yet.
X
  • Filter
  • Time
Clear All
new posts

    Problem with exportClientData to excel file: cells with "<" and ">" chars

    Hi,
    I am using smartclient version 10.0.0

    With "exportClientData" there are problems with strings surrounded by the characters "<" and ">" in case of export to excel file.
    Strings do not appear, including the characters "<" and ">".
    For example:
    TEST <TESTB>
    in the excel file
    TEST

    How can I encode the characters "<" and ">" to create the excel file correctly?

    Thanks in advance for your answers.

    #2
    Please try the latest patched version of a more recent version of SmartClient (10.0 is just about to be end-of-lifed). If you still have the problem, please show us a minimal, ready-to-run test case showing how it can be reproduced in a recent version, such as 12.1.

    If you need special help with an older version of SmartClient, you can get that via our consulting services.

    Comment


      #3
      Hi Isomorphic .
      I run this example code (I cannot use the code on which I detected the problem, it is owned by my company) with smarclient version 12.1 and 10:
      Code:
      // Create a "clientOnly" datasource that represents a Code table.
                      var dsCodeTable = isc.DataSource.create( {
                                      name: "codeTable",
                                      clientOnly: true,
                                      fields: [
                                                      { name: "ID", type: "number", primaryKey: true },
                                                      { name: "CODE", type: "text" },
                                                      { name: "DESCRIPTION", type: "text" }
                                      ],
                                      testData:
                                      [
                                                      { "ID": 19999, "CODE": "A", "DESCRIPTION": "First&lt;test&gt;" },
                                                      { "ID": 29999, "CODE": "B", "DESCRIPTION": "<Second>" },
                                                      { "ID": 39999, "CODE": "C", "DESCRIPTION": "Third" },
                                                      { "ID": 49999, "CODE": "D", "DESCRIPTION": "Fourth" },
                                                      { "ID": 59999, "CODE": "E", "DESCRIPTION": "Fifth" },
                                                      { "ID": 0, "CODE": "", "DESCRIPTION": "None of the Above" }
                                      ]
                      });
                      // Add the code table to a ListGrid.
                      var gridCodeTable = isc.ListGrid.create( {
                                      canEdit: true,
                                      ID: "CodeTableGrid",
                                      editEvent: "click",
                                      dataSource: dsCodeTable,
                                      autoFitData: true,
                                      autoFetchData: true,
                                      height: 130
                      });
                      // This is creates the Export button
                      var buttonExport = isc.IButton.create({
                                      ID: "ButtonExport",
                                      title: "Export Data",
                                      click: function () {
                                                      gridCodeTable.exportClientData( {exportFormat: "csv"} );
                                      }
                      });          
                      var layoutCodeTable = isc.VLayout.create( {
                                      ID: "LayoutCodeTable",
                                      width: 350,
                                      autoSize: true,
                                      membersMargin: 5,
                                      members: [ gridCodeTable, buttonExport ]
                      } );
                      // Display the layout on the screen.
                      layoutCodeTable.show();
      In the first line the "DESCRIPTION" field is "First &lt;test&gt;", in the second it is "<second>".
      The first "DESCRIPTION" is correctly seen in the list grid as "First <test>", the second "DESCRIPTION" is not seen.
      If you export by clicking on the "Export Data" button, the "<test>" string and "<second>" string are not present in the product ".csv" file.
      In the case described in my previous post the export is in excel file, in this example it is a ".csv" file but the problem is identical.
      This is the contents of the ".csv" file:
      Code:
      "Id","Code","Description"
      "19999","A","First"
      "29999","B",""
      "39999","C","Third"
      "49999","D","Fourth"
      "59999","E","Fifth"
      "0","","None of the Above"
      Can the export be corrected so that there are also strings with the symbols "<" ">"?
      Last edited by Enri_000; 5 Mar 2021, 08:27.

      Comment


        #4
        If you use exportData(), you'll get the tags as you hoped. exportClientData() is explicitly doc'd to make the export look like what the user sees. The user doesn't see the tags in your grid, because they are interpreted as HTML tags.

        If you set field.escapeHTML on your grid, then the tags will be visible to your end users, and also be included in the result of exportClientData().

        Comment


          #5
          Hi Isomorphic .
          Thanks for the suggestion.
          With the "escapeHTML" attribute the tags are visible, but only on the list grid, they are not seen in the export file.
          I tried on the example code from my previous post by entering "escapeHTML" in the DESCRIPTION field:
          Code:
          {name: "DESCRIPTION", type: "text", escapeHTML: true}.
          Same result applying the "escapeHTML" attribute to the code I work on: the export doesn't work.

          I used exportClientData.

          Did I apply the attribute incorrectly?
          Last edited by Enri_000; 16 Mar 2021, 09:31.

          Comment


            #6
            Some adjustments must be made to how we're handling HTML field content during exportClientData(). We'll update this thread when those changes have made it in.

            Comment


              #7
              Hi Isomorphic .
              Thanks for your answer.
              Will corrections be made to the latest version only?

              Comment


                #8
                Most fixes are not getting ported to SC 10.0 any more, as it's very old, and seldom built, so it's unlikely to get updated for this. Fixes normally will get applied to the current release, and then backported to older releases if the effort isn't too great, with more recent releases having priority. You should probably update to the current release.

                Comment


                  #9
                  Hi, I am facing similar issue, do you have any fix for this?

                  Comment


                    #10
                    This was fixed 3 years ago and the fix is already explained above.

                    Comment


                      #11
                      Thanks for the response. I am using smart client version 12.1 and I am still seeing the issue.

                      Note: I tried set field.escapeHTML then the characters "<" and ">" are visible only on the list grid, they are not seen in the export file.
                      Last edited by vidyap; Yesterday, 12:58.

                      Comment

                      Working...
                      X