increasing cells width and height

322 views
Skip to first unread message

abhijeet mote

unread,
Apr 23, 2014, 1:14:22 AM4/23/14
to jopend...@googlegroups.com
Hello please let me know how to increase the size of the cell width and height as per cell. i want its wrapped according to the text.

Anton Lukashchuk

unread,
May 8, 2014, 6:09:52 AM5/8/14
to jopend...@googlegroups.com
Hi, You can adjust width of a column, there's a method SpreadSheet.Sheet.Column.setWidth(Number);
But be sure You use v1.3 library, as it doesn't work in v1.4 rc1, because of wrong method signature.

To change the

abhijeet mote

unread,
May 8, 2014, 2:51:38 PM5/8/14
to jopend...@googlegroups.com

Hey hi...
Thanks for the reply. I will see today only and try to apply in my project. thanks once again from ourGNUKhata team and one of the problem in our report would be solved our GNUKhata team would be happy for this

--

---
You received this message because you are subscribed to a topic in the Google Groups "jOpenDocument" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/jopendocument/Vv_mmPt21ck/unsubscribe.
To unsubscribe from this group and all its topics, send an email to jopendocumen...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

abhijeet mote

unread,
May 11, 2014, 12:20:17 AM5/11/14
to jopend...@googlegroups.com
Hey hi
i trying out this example in this its not working SpreadSheet.Sheet.Column.
setWidth(Number); even though i had added the v1.3 library, can u please help me out in this. For below example i am trying to add.
in this i want to increase the width of the cell.




import java.awt.Color;
import java.io.File;
import java.io.FileNotFoundException;
import java.io.IOException;

import javax.swing.table.DefaultTableModel;
import javax.swing.table.TableModel;

import org.jopendocument.dom.ODDocument;
import org.jopendocument.dom.OOUtils;
import org.jopendocument.dom.spreadsheet.Column;
import org.jopendocument.dom.spreadsheet.SpreadSheet;
import org.jopendocument.dom.spreadsheet.Table;


public class Test12 {

    /**
     * @param args
     */
    public static void main(String[] args) {
       
        final Object[][] data = new Object[6][2];
          data[0] = new Object[] { "Januaryajdfa;lsdkfjakdsfmasldkf;asjdflkasj;d", 1 };
          data[1] = new Object[] { "February", 3 };
          data[2] = new Object[] { "March", 8 };
          data[3] = new Object[] { "April", 10 };
          data[4] = new Object[] { "May", 15 };
          data[5] = new Object[] { "June", 18 };
         
          String[] columns = new String[] { "Month", "Temp" };

         
          TableModel model = new DefaultTableModel(data, columns); 
         
          // Save the data to an ODS file and open it.
          final File file = new File("temperature.ods");
          try {
            SpreadSheet.createEmpty(model).saveAs(file);
           
             OOUtils.open(file);
        } catch (FileNotFoundException e) {
            // TODO Auto-generated catch block
            e.printStackTrace();
        } catch (IOException e) {
            // TODO Auto-generated catch block
            e.printStackTrace();
        }
           
         


    }

}

Sylvain Cuaz

unread,
May 12, 2014, 12:12:21 PM5/12/14
to jopend...@googlegroups.com
Le 08/05/2014 12:09, Anton Lukashchuk a écrit :
> Hi, You can adjust width of a column, there's a method
> SpreadSheet.Sheet.Column.setWidth(Number);
> But be sure You use v1.3 library, as it doesn't work in v1.4 rc1, because
> of wrong method signature.

1.4 introduced the class Length and fixed a number of bugs. What do you mean by "wrong method
signature" ?

An example : sheet.getColumn(0).setWidth(Length.MM(20));

Cheers,
Sylvain

abhijeet mote

unread,
May 12, 2014, 1:15:14 PM5/12/14
to jopend...@googlegroups.com

I had solved that problem using different method... I will tell u that method.  Now i am trying to align the text or numbers to right.. And what about to merge the cells...
For template do u have any working example... Cause i am getting the errors in that template one also...

--

--- You received this message because you are subscribed to a topic in the Google Groups "jOpenDocument" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/jopendocument/Vv_mmPt21ck/unsubscribe.
To unsubscribe from this group and all its topics, send an email to jopendocument+unsubscribe@googlegroups.com.

Anton Lukashchuk

unread,
May 13, 2014, 4:38:50 AM5/13/14
to jopend...@googlegroups.com

1.4 introduced the class Length and fixed a number of bugs. What do you mean by "wrong method
signature" ?

An example : sheet.getColumn(0).setWidth(Length.MM(20));

Cheers,
Sylvain

Thank You!
I just didn't figure that out, thought that "Length" is just wrong parameter type.
Reply all
Reply to author
Forward
0 new messages