1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54
|
Object [][] tableau = new Object[7][2];
tableau[0][0] = "Valeur";
tableau[0][1] = "CCR";
tableau[1][0] = "50";
tableau[1][1] = "Trop intense";
tableau[2][0] = "40 - 49";
tableau[2][1] = "Très lourd";
tableau[3][0] = "30 - 39";
tableau[3][1] = "Lourd";
tableau[4][0] = "20 - 29";
tableau[4][1] = "Plutôt lourd";
tableau[5][0] = "10 - 19";
tableau[5][1] = "Léger";
tableau[6][0] = "0 - 9";
tableau[6][1] = "Très léger";
XMultiServiceFactory xMSF = (XMultiServiceFactory) UnoRuntime.queryInterface(XMultiServiceFactory.class, xDocument);
XTextTable xTextTable = ( XTextTable ) UnoRuntime.queryInterface(
XTextTable.class, xMSF.createInstance( "com.sun.star.text.TextTable" ) );
xTextTable.initialize( 7, 2);
xTextDocument.getText().insertTextContent( xTextRange, xTextTable, false );
XPropertySet xPS = ( XPropertySet ) UnoRuntime.queryInterface(
XPropertySet.class, xTextTable );
XCell xCell;
char tableauXLS[]={'A','B','C','D','E','F','G','H','I','J','K','L','M','N','O','P','Q','R','S','T','U','V','W','X','Y','Z'};
for(int i=0 ; i < 7 ; ++i )
{
for(int j=0 ; j < 2 ; ++j )
{
xCell = xTextTable.getCellByName(""+tableauXLS[j]+(i+1));
XTextRange xTextRange = (XTextRange) UnoRuntime.queryInterface(XTextRange.class, xCell);
xTextRange.setString((String) tableau[i][j]);
xPS = ( XPropertySet ) UnoRuntime.queryInterface(
XPropertySet.class, xCell );
xPS.setPropertyValue( "VertOrient", com.sun.star.text.VertOrientation.TOP );
}
} |
Partager