Announcement

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

    Export date format

    Hello,
    I used smartGWT 5.0 version. On Ui I can can date fields on my format dd.MM.yyyy, but when I made an export like datasource.exportData(dsRequest) the exported data is in format yyyy-MM-dd. How could I set the export format for date?
    Example: in UI date is 17.04.2015 in export csv fiel data is 2015-04-17.

    Also some german characters are not looking on export file for example "Geändert am" is "Geändert am" even if I use UTF-8 encoding

    Best regards,
    Marius
    Last edited by mariusc; 17 Apr 2015, 04:01.

    #2
    See DataSourceField.format and exportFormat.

    About German characters, see the Internationalization overview.

    Comment


      #3
      Regarding german umlauts, maybe you didn't understand, but Internationalization is good, I can see correct values on UI. But when I export CSV and XLS and open files with notepad characters looks good, but when I open with Microsoft Excel characters looks strange.
      I use this code:

      DSRequest request = new DSRequest();
      request.setExportFilename(id);
      request.setExportRawValues(false);
      request.setExportAs(exportFormat);
      request.setExportFields(getExportedFields(listGrid));
      request.setExportPropertyIdentifier(PropertyIdentifier.TITLE);
      listGrid.exportData(request);


      Thank you.

      Comment


        #4
        If you open a .csv file with Notepad and see the correct characters, there's nothing more that our server framework can do - the output is already correct, and something appears to be broken with your Microsoft Excel installation if you get different results opening the same file. You may need to configure it to use UTF-8, if it is currently forcing some other encoding.

        Comment


          #5


          Originally posted by Isomorphic View Post
          See DataSourceField.format and exportFormat.

          About German characters, see the Internationalization overview.
          I have similar issue in 4.1-p20160412.

          As I can read in documentation for this function:
          void com.smartgwt.client.widgets.grid.ListGrid.exportData(DSRequest requestProperties)
          Uses a "fetch" operation on the current DataSource to retrieve data that matches the current filter and sort criteria for this component, then exports the resulting data to a file or window in the requested format.
          A variety of DSRequest settings, such as exportAs and exportFilename, affect the exporting process: see exportResults for further detail.
          Note that data exported via this method does not include any client-side formatting and relies on both the Smart GWT server and server-side DataSources. To export client-data with formatters applied, see exportClientData, which still requires the Smart GWT server but does not rely on server-side DataSources.


          Unfortunately I get strange format YYYY-M-D ex "2016-4-9" it could't be reimported. I expected 2016-04-09. I can't find what setting is responsible for this format.

          if I tried ExportClientData instead ExportData I had two cases:
          1. For small table it worked bud didn't respect formatting field.setExportFormat("YYYY-MM-dd"), I got "2016/04/09" better, but not "2016-04-09"
          2. For larger (150 rows, 10 columns) table it said "The server did not receive the data that was sent to it. Please see the documentation for isc.RPCResponse.STATUS_MAX_POST_SIZE_EXCEEDED


          Mariusc, I have valid UTF-8 character in text editor (polish ąęśćłóńżź etc), but I cant't import it properly as CSV file to Excel. I see "wewnÄ™trzn So I think it is Excel issue
          Last edited by Sanmargar; 19 Apr 2016, 09:12.

          Comment


            #6
            Guys, have you tried things like this (instructions are for Excel 2007, but they work up to Excel 2016)? I took the problem words you posted here 'Geändert am' and 'ąęśćłóńżź', included them in a utf-8 encoded csv file along with some problem words in Spanish, and opened it in Excel, using the 'import' wizard, selecting the 65001: Unicode (UTF-8) encoding, and here is the result:

            Click image for larger version

Name:	ImportUTF8Excel.png
Views:	140
Size:	13.1 KB
ID:	237194

            Comment

            Working...
            X