Announcement

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

    Excel Export issues with custom header and column titles

    Hi, I am using Smart Client v8.3p_2013-03-18/Pro Development Only. I am noticing some issues with custom headers (exportHeader) and column names not getting exported properly. I am noticing these when using exportClientData() with exportAs set to both XLS and OOXML and I would think this would similarly affect exportData(). I was hoping you could help look at these 3 issues. I appreciate your help in advance!

    I have a simple ListGrid with expansion components and below are the issues I am experiencing. Just to note, setting the footer seems to work okay.

    (1) Exporting to excel with export fields specified (so the first column that shows the expansion icon doesn't show as empty in the exported report) results in the following. My expectation was that the both the header and column names would display with the header in a separate row (spanning all data columns) above the row displaying the column headers. Also attached is export1.png to see the two issues below:
    (a) Header value is displayed but it spans three rows and all the data columns.
    (b) Column headers are not displayed appropriately probably because of (a). No column headers are displayed except for the last one (units) since it is shifted over past the last column displaying its data.

    Here is the code used for the export.

    Code:
    itemList.exportClientData({ exportAs: "xls", exportDisplay: "window", exportHeader: "---- header ----", exportFooter: "---- footer ----", exportFields: ["itemName", "SKU", "unitCost", "units"]});
    (2) I created a custom DMI so I can customize the data returned by just adding operationId: "customExport" to the exportClientData() function.
    However, doing this, I see different results. The custom header doesn't get displayed but instead the first column name "item" gets displayed spanning 3 rows and all the data columns instead of what I saw in (1). I even simplified the custom method to just call execute on the dsRequest but still see this difference. I would expect this to result in the same results as (1) since I am just calling execute() on the dsRequest.
    Code:
    public class CustomExportDMI {
    	public static DSResponse customExport(DSRequest dsRequest, HttpServletRequest servletRequest) throws Exception {
    		return dsRequest.execute();
    	}
    }
    This is what I have in my data source file.
    Code:
    	<operationBindings>
    		<operationBinding operationType="clientExport" operationId="customExport" >
    			<serverObject className="com.isomorphic.examples.server.testCustomExport.CustomExportDMI" lookupStyle="new" />
    			<serverMethod>customExport</serverMethod>
    		</operationBinding>
    	</operationBindings>
    (3) In addition to displaying a custom header, I would also like to customize the default column field titles displayed below the header but setting exportFieldTitles on the dsRequest doesn't seem to make a difference. Here is the psuedocode (I had to remove the exportHeader setting to test seeing the column names exported). Any ideas why?
    Code:
    public static DSResponse customExport(DSRequest dsRequest, HttpServletRequest servletRequest) throws Exception {
    
            Map<String,String> exportFieldTitles = new HashMap<String,String>();
            exportFieldTitles.put("itemName", "Name");
            exportFieldTitles.put("SKU", "Item SKU");
            exportFieldTitles.put("unitCost", "Cost");
            exportFieldTitles.put("units", "Units");
    
            dsRequest.setExportFieldTitles(exportFieldTitles);
    
    	DSResponse response = dsRequest.execute();
    
    	List data = response.getDataList();
    
            for (Iterator i = data.iterator(); i.hasNext(); ) {
            	Map record = (Map)i.next();
            	
            	// change data
            }
    
            response.setData(data);
    
            return response;
    }
    Code:
    itemList.exportClientData({ exportAs: "xls", exportDisplay: "window", exportFooter: "---- footer ----", exportFields: ["itemName", "SKU", "unitCost", "units"]});
    Attached Files
Working...
X