Hello to all,

The problem I encounter when I try to copy lines from ULCTable to MS Excel with Ctrl+C and Ctrl+V, is that copied data into clipboard contains number and date format without accepting renderers in table columns. And Czech Excel shows pasting number and date as text, not as requested. I have table with many rows and need to copy lines only on client without any server roundtrip. I find out that a value for copy is acquiring in UITableModelAdapter's getValueAt(int rowIndex, int columnIndex) method.

Expected result:
 31.7.2003     2 848,00        do roku 2005
 31.5.2003     34 709,00       do roku 2005
 13.6.2003     450,00          do roku 2005

Actual result:
 Thu Jul 31 00:00:00 CEST 2003     2848.00         do roku 2005
 Sat May 31 00:00:00 CEST 2003     34709.00        do roku 2005
 Fri Jun 13 00:00:00 CEST 2003     450.0           do roku 2005


This is what I have in my code ...

private void updateTableLook() {
   ...
   for (int i = 0; i < _tableModel.getColumnCount(); i++) {
       ULCTableColumn column = _table.getColumnModel().getColumn(i);
// column renderer's
       String typ = _tableModel.getColumnTyp(i);
       if (typ.equals("B")) {
           column.setCellRenderer(new BooleanRenderer());
       } else if (typ.equals("D")) {
           column.setCellRenderer(new DateRenderer());
       } else if (typ.equals("T")) {
           column.setCellRenderer(new DateTimeRenderer());
       } else if (typ.equals("N")) {
           column.setCellRenderer(new DecimalRenderer());
       } else if (typ.equals("I")) {
           column.setCellRenderer(new IntegerRenderer());
       } else if (typ.equals("L")) {
           column.setCellRenderer(new LongRenderer());
       }
_table.repaint();
}
public class DateRenderer extends DefaultTableCellRenderer {
   public DateRenderer() {
       setDataType(new ULCCzDateDataType());
   }
}

public class ULCCzDateDataType extends ULCDateDataType {
   public static final String DEFAULT_FORMAT = "d.M.yyyy";
public ULCCzDateDataType(String format) {
       if (format != null && !format.equals("")) {
           super.setFormatString(format);
       } else {
setFormatString(DEFAULT_FORMAT); }
   }
public ULCCzDateDataType() {
       this(DEFAULT_FORMAT);
   }
protected String typeString() {
       return "cz.cosma.cis.base.client.util.datatype.UICzDateDataType";
   }
}

public class UICzDateDataType extends com.ulcjava.base.client.datatype.UIDateDataType {
}


Extending UICzDateDataType's method convertToString(Object object, boolean forEditing) don't affect the result.
ULC 6.1.3 on Windows 2000, Java 1.5.0_04 and Czech version of Excel.


Thanks and regards,

Vladimir Turek
_______________________________________________
ULC-developer mailing list
[email protected]
http://lists.canoo.com/mailman/listinfo/ulc-developer

Reply via email to