Hi Isomorphic,
I have a problem with exportData() + exportFormat (using v12.0p_2020-03-11 and v12.0p_2020-05-03).
The format String is applied as hard coded text like this in Libre Office (v6.4.2.2), "HH:mm:ss" is a correct FormatString per it's docs.
The use case here is that we are calculating a date difference and output this a float. Here the number 1 equals 1 day in Excel.
Pleas note that the format string should also support this format: exportFormat="[HH]:mm:ss", where the [] denote that the hours should not be displayed mod 24 in the Excel cell (see "Time formats" here).
Please see this BuiltInDS based test case (v12.0p_2020-05-03):
supplyItem.ds.xml:
BuiltInDS.java:
Best regards
Blama
I have a problem with exportData() + exportFormat (using v12.0p_2020-03-11 and v12.0p_2020-05-03).
The format String is applied as hard coded text like this in Libre Office (v6.4.2.2), "HH:mm:ss" is a correct FormatString per it's docs.
The use case here is that we are calculating a date difference and output this a float. Here the number 1 equals 1 day in Excel.
Pleas note that the format string should also support this format: exportFormat="[HH]:mm:ss", where the [] denote that the hours should not be displayed mod 24 in the Excel cell (see "Time formats" here).
Please see this BuiltInDS based test case (v12.0p_2020-05-03):
supplyItem.ds.xml:
Code:
<field name="unitCost" type="float" title="Unit Cost" required="true" [B]exportFormat="HH:mm:ss"[/B]>
Code:
package com.smartgwt.sample.client; import com.google.gwt.core.client.EntryPoint; import com.smartgwt.client.Version; import com.smartgwt.client.core.KeyIdentifier; import com.smartgwt.client.data.DSRequest; import com.smartgwt.client.data.DataSource; import com.smartgwt.client.types.ExportFormat; import com.smartgwt.client.util.Page; import com.smartgwt.client.util.PageKeyHandler; import com.smartgwt.client.util.SC; import com.smartgwt.client.widgets.IButton; import com.smartgwt.client.widgets.Window; import com.smartgwt.client.widgets.events.ClickEvent; import com.smartgwt.client.widgets.events.ClickHandler; import com.smartgwt.client.widgets.grid.ListGrid; import com.smartgwt.client.widgets.layout.VLayout; public class BuiltInDS implements EntryPoint { private VLayout mainLayout; private IButton recreateBtn; public void onModuleLoad() { KeyIdentifier debugKey = new KeyIdentifier(); debugKey.setCtrlKey(true); debugKey.setKeyName("D"); Page.registerKey(debugKey, new PageKeyHandler() { public void execute(String keyName) { SC.showConsole(); } }); mainLayout = new VLayout(20); mainLayout.setWidth100(); mainLayout.setHeight100(); recreateBtn = new IButton("Recreate"); recreateBtn.addClickHandler(new ClickHandler() { @Override public void onClick(ClickEvent event) { recreate(); } }); mainLayout.addMember(recreateBtn); recreate(); mainLayout.draw(); } private void recreate() { Window w = new Window(); w.setWidth("95%"); w.setHeight("95%"); w.setMembersMargin(0); w.setModalMaskOpacity(70); w.setTitle(" (" + Version.getVersion() + "/" + Version.getSCVersionNumber() + ")"); w.setTitle( "FormatString issues in exportData()" + w.getTitle()); w.setShowMinimizeButton(false); w.setIsModal(true); w.setShowModalMask(true); w.centerInPage(); final ListGrid supplyItemGrid = new ListGrid(DataSource.get("supplyItem")); supplyItemGrid.setAutoFetchData(true); supplyItemGrid.setExportFieldWidths(true); supplyItemGrid.setExportWidthScale(0.18); supplyItemGrid.setCanEdit(true); supplyItemGrid.setShowFilterEditor(true); IButton exportDataBtn = new IButton("exportData()", new ClickHandler() { @Override public void onClick(ClickEvent event) { final DSRequest exportRequest = new DSRequest(); exportRequest.setExportAs(ExportFormat.OOXML); exportRequest.setExportFilename("myExport"); supplyItemGrid.exportData(exportRequest); } }); VLayout vLayout = new VLayout() { { addMembers(supplyItemGrid, exportDataBtn); } }; w.addItem(vLayout); w.show(); } }
Blama
Comment