Index: src/org/openbravo/erpCommon/utility/TableSQLData.java
===================================================================
--- src/org/openbravo/erpCommon/utility/TableSQLData.java	(revision 8757)
+++ src/org/openbravo/erpCommon/utility/TableSQLData.java	(working copy)
@@ -1278,10 +1278,14 @@
   }
 
   public SQLReturnObject[] getHeaders() {
-    return getHeaders(false);
+    return getHeaders(false, false);
+  }
+  
+  public SQLReturnObject[] getHeaders(boolean useFieldLength) {
+    return getHeaders(false, useFieldLength);
   }
 
-  public SQLReturnObject[] getHeaders(boolean withoutIdentifiers) {
+  public SQLReturnObject[] getHeaders(boolean withoutIdentifiers, boolean useFieldLength) {
     SQLReturnObject[] data = null;
     Vector<SQLReturnObject> vAux = new Vector<SQLReturnObject>();
     Vector<Properties> structure = getStructure();
@@ -1313,12 +1317,21 @@
           type="float";
         }
         dataAux.setData("type", type);
-        String strWidth = prop.getProperty("DisplayLength");
+        String strWidth = "";
+        
+        if(useFieldLength)
+        	strWidth = prop.getProperty("FieldLength");
+        else
+        	strWidth = prop.getProperty("DisplayLength");
+        
         if (strWidth==null || strWidth.equals("")) strWidth = "0";
         int width = Integer.valueOf(strWidth).intValue();
         width = width * 6;
-        if (width<23) width=23;
-        else if (width>300) width=300;
+        
+        if(!useFieldLength) {
+	        if (width<23) width=23;
+	        else if (width>300) width=300;
+        }
         dataAux.setData("width", Integer.toString(width));
         
         if (cloneRecord) {
Index: src/org/openbravo/erpCommon/utility/ExportGrid.java
===================================================================
--- src/org/openbravo/erpCommon/utility/ExportGrid.java	(revision 8757)
+++ src/org/openbravo/erpCommon/utility/ExportGrid.java	(working copy)
@@ -53,7 +53,7 @@
     if (log4j.isDebugEnabled()) log4j.debug("*********************Base design path: " + strBaseDesign);
 
     try {
-      GridReportVO gridReportVO = createGridReport(vars, strTabId);
+      GridReportVO gridReportVO = createGridReport(vars, strTabId, vars.commandIn("EXCEL"));
       os = response.getOutputStream();
       is = getInputStream(strBaseDesign+"/org/openbravo/erpCommon/utility/"+gridReportVO.getJrxmlTemplate());
       gridBO = new GridBO();
@@ -81,7 +81,12 @@
       os.close();
     }
   }
-  GridReportVO createGridReport(VariablesSecureApp vars, String strTabId) throws ServletException{
+  
+  GridReportVO createGridReport(VariablesSecureApp vars, String strTabId) throws ServletException{ 
+	  return createGridReport(vars, strTabId, false);
+  }
+  
+  GridReportVO createGridReport(VariablesSecureApp vars, String strTabId, boolean useFieldLength) throws ServletException{
     if (log4j.isDebugEnabled()) log4j.debug("Create Grid Report, tabID: " + strTabId);
     LinkedList<GridColumnVO> columns = new LinkedList<GridColumnVO>();
     FieldProvider[] data = null;
@@ -93,7 +98,7 @@
       log4j.error(ex.getMessage());
       throw new ServletException(ex.getMessage());
     }
-    SQLReturnObject[] headers = tableSQL.getHeaders(true);
+    SQLReturnObject[] headers = tableSQL.getHeaders(true, useFieldLength);
 
     if (tableSQL!=null && headers!=null) {
       try{
