1*eba4d44aSLiu Zhe package fvt.uno.sw.table; 2*eba4d44aSLiu Zhe 3*eba4d44aSLiu Zhe import static org.junit.Assert.*; 4*eba4d44aSLiu Zhe 5*eba4d44aSLiu Zhe import org.junit.After; 6*eba4d44aSLiu Zhe import org.junit.Before; 7*eba4d44aSLiu Zhe import org.junit.Test; 8*eba4d44aSLiu Zhe import org.openoffice.test.common.FileUtil; 9*eba4d44aSLiu Zhe import org.openoffice.test.common.Testspace; 10*eba4d44aSLiu Zhe import org.openoffice.test.uno.UnoApp; 11*eba4d44aSLiu Zhe 12*eba4d44aSLiu Zhe import com.sun.star.uno.UnoRuntime; 13*eba4d44aSLiu Zhe import com.sun.star.text.*; 14*eba4d44aSLiu Zhe import com.sun.star.lang.XMultiServiceFactory; 15*eba4d44aSLiu Zhe import com.sun.star.beans.PropertyValue; 16*eba4d44aSLiu Zhe import com.sun.star.beans.XPropertySet; 17*eba4d44aSLiu Zhe import com.sun.star.container.XIndexAccess; 18*eba4d44aSLiu Zhe import com.sun.star.frame.XStorable; 19*eba4d44aSLiu Zhe 20*eba4d44aSLiu Zhe 21*eba4d44aSLiu Zhe public class TableVerticalAlignment { 22*eba4d44aSLiu Zhe 23*eba4d44aSLiu Zhe private static final UnoApp app = new UnoApp(); 24*eba4d44aSLiu Zhe private XTextDocument xTextDocument=null; 25*eba4d44aSLiu Zhe private XMultiServiceFactory xWriterFactory=null; 26*eba4d44aSLiu Zhe private XText xText=null; 27*eba4d44aSLiu Zhe @Before 28*eba4d44aSLiu Zhe public void setUp() throws Exception { 29*eba4d44aSLiu Zhe app.start(); 30*eba4d44aSLiu Zhe } 31*eba4d44aSLiu Zhe 32*eba4d44aSLiu Zhe @After 33*eba4d44aSLiu Zhe public void tearDown() throws Exception { 34*eba4d44aSLiu Zhe app.close(); 35*eba4d44aSLiu Zhe } 36*eba4d44aSLiu Zhe /* 37*eba4d44aSLiu Zhe * test table border spacing to content 38*eba4d44aSLiu Zhe * 1.new a text document and create a table 39*eba4d44aSLiu Zhe * 2.set table cell vertical alignment 40*eba4d44aSLiu Zhe * 3.save to odt/doc,close it and reopen new saved document 41*eba4d44aSLiu Zhe * 4.check the table cell vertical alignment 42*eba4d44aSLiu Zhe */ 43*eba4d44aSLiu Zhe @Test 44*eba4d44aSLiu Zhe public void testtableVerticalAlignment_Bottom() throws Exception { 45*eba4d44aSLiu Zhe xTextDocument =(XTextDocument)UnoRuntime.queryInterface(XTextDocument.class, app.newDocument("swriter")); 46*eba4d44aSLiu Zhe xText=xTextDocument.getText(); 47*eba4d44aSLiu Zhe XTextCursor xTextCursor = xText.createTextCursor(); 48*eba4d44aSLiu Zhe // get internal service factory of the document 49*eba4d44aSLiu Zhe xWriterFactory =(XMultiServiceFactory)UnoRuntime.queryInterface(XMultiServiceFactory.class, xTextDocument); 50*eba4d44aSLiu Zhe // Create a new table from the document's factory 51*eba4d44aSLiu Zhe XTextTable xTable = (XTextTable)UnoRuntime.queryInterface(XTextTable.class, xWriterFactory.createInstance("com.sun.star.text.TextTable")); 52*eba4d44aSLiu Zhe xText.insertTextContent(xTextCursor,xTable,false); 53*eba4d44aSLiu Zhe String[] cellName=xTable.getCellNames(); 54*eba4d44aSLiu Zhe int i=0; 55*eba4d44aSLiu Zhe while(cellName[i] != null) 56*eba4d44aSLiu Zhe { 57*eba4d44aSLiu Zhe XPropertySet xCursorProps = (XPropertySet)UnoRuntime.queryInterface(XPropertySet.class,xTable.getCellByName(cellName[i])); 58*eba4d44aSLiu Zhe xCursorProps.setPropertyValue("VertOrient",VertOrientation.BOTTOM); 59*eba4d44aSLiu Zhe i++; 60*eba4d44aSLiu Zhe if(i==4)break; 61*eba4d44aSLiu Zhe } 62*eba4d44aSLiu Zhe //save to odt 63*eba4d44aSLiu Zhe XStorable xStorable_odt = (XStorable) UnoRuntime.queryInterface(XStorable.class, xTextDocument); 64*eba4d44aSLiu Zhe PropertyValue[] aStoreProperties_odt = new PropertyValue[2]; 65*eba4d44aSLiu Zhe aStoreProperties_odt[0] = new PropertyValue(); 66*eba4d44aSLiu Zhe aStoreProperties_odt[1] = new PropertyValue(); 67*eba4d44aSLiu Zhe aStoreProperties_odt[0].Name = "Override"; 68*eba4d44aSLiu Zhe aStoreProperties_odt[0].Value = true; 69*eba4d44aSLiu Zhe aStoreProperties_odt[1].Name = "FilterName"; 70*eba4d44aSLiu Zhe aStoreProperties_odt[1].Value = "StarOffice XML (Writer)"; 71*eba4d44aSLiu Zhe xStorable_odt.storeToURL(FileUtil.getUrl(Testspace.getPath("output/test.odt")), aStoreProperties_odt); 72*eba4d44aSLiu Zhe //save to doc 73*eba4d44aSLiu Zhe XStorable xStorable_doc = (XStorable) UnoRuntime.queryInterface(XStorable.class, xTextDocument); 74*eba4d44aSLiu Zhe PropertyValue[] aStoreProperties_doc = new PropertyValue[2]; 75*eba4d44aSLiu Zhe aStoreProperties_doc[0] = new PropertyValue(); 76*eba4d44aSLiu Zhe aStoreProperties_doc[1] = new PropertyValue(); 77*eba4d44aSLiu Zhe aStoreProperties_doc[0].Name = "Override"; 78*eba4d44aSLiu Zhe aStoreProperties_doc[0].Value = true; 79*eba4d44aSLiu Zhe aStoreProperties_doc[1].Name = "FilterName"; 80*eba4d44aSLiu Zhe aStoreProperties_doc[1].Value = "MS Word 97"; 81*eba4d44aSLiu Zhe xStorable_doc.storeToURL(FileUtil.getUrl(Testspace.getPath("output/test.doc")), aStoreProperties_doc); 82*eba4d44aSLiu Zhe app.closeDocument(xTextDocument); 83*eba4d44aSLiu Zhe 84*eba4d44aSLiu Zhe //reopen the odt document and assert table vertical alignment 85*eba4d44aSLiu Zhe XTextDocument assertDocument_odt=(XTextDocument)UnoRuntime.queryInterface(XTextDocument.class, app.loadDocument(Testspace.getPath("output/test.odt"))); 86*eba4d44aSLiu Zhe XTextTablesSupplier xTablesSupplier_odt = (XTextTablesSupplier) UnoRuntime.queryInterface(XTextTablesSupplier.class, assertDocument_odt ); 87*eba4d44aSLiu Zhe XIndexAccess xIndexedTables_odt = (XIndexAccess) UnoRuntime.queryInterface(XIndexAccess.class, xTablesSupplier_odt.getTextTables()); 88*eba4d44aSLiu Zhe Object xTable_obj_odt=xIndexedTables_odt.getByIndex(0); 89*eba4d44aSLiu Zhe XTextTable xTable_Assert_odt=(XTextTable) UnoRuntime.queryInterface(XTextTable.class, xTable_obj_odt); 90*eba4d44aSLiu Zhe String[] cellName_assert_odt=xTable_Assert_odt.getCellNames(); 91*eba4d44aSLiu Zhe int j=0; 92*eba4d44aSLiu Zhe while(cellName_assert_odt[j] != null) 93*eba4d44aSLiu Zhe { 94*eba4d44aSLiu Zhe XPropertySet xCursorProps_assert_odt = (XPropertySet)UnoRuntime.queryInterface(XPropertySet.class,xTable_Assert_odt.getCellByName(cellName_assert_odt[j])); 95*eba4d44aSLiu Zhe assertEquals("assert table border spacing to content",VertOrientation.BOTTOM,xCursorProps_assert_odt.getPropertyValue("VertOrient")); 96*eba4d44aSLiu Zhe j++; 97*eba4d44aSLiu Zhe if(j==4)break; 98*eba4d44aSLiu Zhe } 99*eba4d44aSLiu Zhe 100*eba4d44aSLiu Zhe //reopen the doc document and assert table vertical alignment 101*eba4d44aSLiu Zhe XTextDocument assertDocument_doc=(XTextDocument)UnoRuntime.queryInterface(XTextDocument.class, app.loadDocument(Testspace.getPath("output/test.doc"))); 102*eba4d44aSLiu Zhe XTextTablesSupplier xTablesSupplier_doc = (XTextTablesSupplier) UnoRuntime.queryInterface(XTextTablesSupplier.class, assertDocument_doc ); 103*eba4d44aSLiu Zhe XIndexAccess xIndexedTables_doc = (XIndexAccess) UnoRuntime.queryInterface(XIndexAccess.class, xTablesSupplier_doc.getTextTables()); 104*eba4d44aSLiu Zhe Object xTable_obj_doc=xIndexedTables_doc.getByIndex(0); 105*eba4d44aSLiu Zhe XTextTable xTable_Assert_doc=(XTextTable) UnoRuntime.queryInterface(XTextTable.class, xTable_obj_doc); 106*eba4d44aSLiu Zhe String[] cellName_assert_doc=xTable_Assert_doc.getCellNames(); 107*eba4d44aSLiu Zhe int k=0; 108*eba4d44aSLiu Zhe while(cellName_assert_doc[k] != null) 109*eba4d44aSLiu Zhe { 110*eba4d44aSLiu Zhe XPropertySet xCursorProps_assert_odt = (XPropertySet)UnoRuntime.queryInterface(XPropertySet.class,xTable_Assert_doc.getCellByName(cellName_assert_doc[k])); 111*eba4d44aSLiu Zhe assertEquals("assert table vertical alignment",VertOrientation.BOTTOM,xCursorProps_assert_odt.getPropertyValue("VertOrient")); 112*eba4d44aSLiu Zhe k++; 113*eba4d44aSLiu Zhe if(k==4)break; 114*eba4d44aSLiu Zhe } 115*eba4d44aSLiu Zhe } 116*eba4d44aSLiu Zhe @Test 117*eba4d44aSLiu Zhe public void testtableVerticalAlignment_Center() throws Exception { 118*eba4d44aSLiu Zhe xTextDocument =(XTextDocument)UnoRuntime.queryInterface(XTextDocument.class, app.newDocument("swriter")); 119*eba4d44aSLiu Zhe xText=xTextDocument.getText(); 120*eba4d44aSLiu Zhe XTextCursor xTextCursor = xText.createTextCursor(); 121*eba4d44aSLiu Zhe // get internal service factory of the document 122*eba4d44aSLiu Zhe xWriterFactory =(XMultiServiceFactory)UnoRuntime.queryInterface(XMultiServiceFactory.class, xTextDocument); 123*eba4d44aSLiu Zhe // Create a new table from the document's factory 124*eba4d44aSLiu Zhe XTextTable xTable = (XTextTable)UnoRuntime.queryInterface(XTextTable.class, xWriterFactory.createInstance("com.sun.star.text.TextTable")); 125*eba4d44aSLiu Zhe xText.insertTextContent(xTextCursor,xTable,false); 126*eba4d44aSLiu Zhe String[] cellName=xTable.getCellNames(); 127*eba4d44aSLiu Zhe int i=0; 128*eba4d44aSLiu Zhe while(cellName[i] != null) 129*eba4d44aSLiu Zhe { 130*eba4d44aSLiu Zhe XPropertySet xCursorProps = (XPropertySet)UnoRuntime.queryInterface(XPropertySet.class,xTable.getCellByName(cellName[i])); 131*eba4d44aSLiu Zhe xCursorProps.setPropertyValue("VertOrient",VertOrientation.CENTER); 132*eba4d44aSLiu Zhe i++; 133*eba4d44aSLiu Zhe if(i==4)break; 134*eba4d44aSLiu Zhe } 135*eba4d44aSLiu Zhe //save to odt 136*eba4d44aSLiu Zhe XStorable xStorable_odt = (XStorable) UnoRuntime.queryInterface(XStorable.class, xTextDocument); 137*eba4d44aSLiu Zhe PropertyValue[] aStoreProperties_odt = new PropertyValue[2]; 138*eba4d44aSLiu Zhe aStoreProperties_odt[0] = new PropertyValue(); 139*eba4d44aSLiu Zhe aStoreProperties_odt[1] = new PropertyValue(); 140*eba4d44aSLiu Zhe aStoreProperties_odt[0].Name = "Override"; 141*eba4d44aSLiu Zhe aStoreProperties_odt[0].Value = true; 142*eba4d44aSLiu Zhe aStoreProperties_odt[1].Name = "FilterName"; 143*eba4d44aSLiu Zhe aStoreProperties_odt[1].Value = "StarOffice XML (Writer)"; 144*eba4d44aSLiu Zhe xStorable_odt.storeToURL(FileUtil.getUrl(Testspace.getPath("output/test.odt")), aStoreProperties_odt); 145*eba4d44aSLiu Zhe //save to doc 146*eba4d44aSLiu Zhe XStorable xStorable_doc = (XStorable) UnoRuntime.queryInterface(XStorable.class, xTextDocument); 147*eba4d44aSLiu Zhe PropertyValue[] aStoreProperties_doc = new PropertyValue[2]; 148*eba4d44aSLiu Zhe aStoreProperties_doc[0] = new PropertyValue(); 149*eba4d44aSLiu Zhe aStoreProperties_doc[1] = new PropertyValue(); 150*eba4d44aSLiu Zhe aStoreProperties_doc[0].Name = "Override"; 151*eba4d44aSLiu Zhe aStoreProperties_doc[0].Value = true; 152*eba4d44aSLiu Zhe aStoreProperties_doc[1].Name = "FilterName"; 153*eba4d44aSLiu Zhe aStoreProperties_doc[1].Value = "MS Word 97"; 154*eba4d44aSLiu Zhe xStorable_doc.storeToURL(FileUtil.getUrl(Testspace.getPath("output/test.doc")), aStoreProperties_doc); 155*eba4d44aSLiu Zhe app.closeDocument(xTextDocument); 156*eba4d44aSLiu Zhe 157*eba4d44aSLiu Zhe //reopen the odt document and assert table vertical alignment 158*eba4d44aSLiu Zhe XTextDocument assertDocument_odt=(XTextDocument)UnoRuntime.queryInterface(XTextDocument.class, app.loadDocument(Testspace.getPath("output/test.odt"))); 159*eba4d44aSLiu Zhe XTextTablesSupplier xTablesSupplier_odt = (XTextTablesSupplier) UnoRuntime.queryInterface(XTextTablesSupplier.class, assertDocument_odt ); 160*eba4d44aSLiu Zhe XIndexAccess xIndexedTables_odt = (XIndexAccess) UnoRuntime.queryInterface(XIndexAccess.class, xTablesSupplier_odt.getTextTables()); 161*eba4d44aSLiu Zhe Object xTable_obj_odt=xIndexedTables_odt.getByIndex(0); 162*eba4d44aSLiu Zhe XTextTable xTable_Assert_odt=(XTextTable) UnoRuntime.queryInterface(XTextTable.class, xTable_obj_odt); 163*eba4d44aSLiu Zhe String[] cellName_assert_odt=xTable_Assert_odt.getCellNames(); 164*eba4d44aSLiu Zhe int j=0; 165*eba4d44aSLiu Zhe while(cellName_assert_odt[j] != null) 166*eba4d44aSLiu Zhe { 167*eba4d44aSLiu Zhe XPropertySet xCursorProps_assert_odt = (XPropertySet)UnoRuntime.queryInterface(XPropertySet.class,xTable_Assert_odt.getCellByName(cellName_assert_odt[j])); 168*eba4d44aSLiu Zhe assertEquals("assert table border spacing to content",VertOrientation.CENTER,xCursorProps_assert_odt.getPropertyValue("VertOrient")); 169*eba4d44aSLiu Zhe j++; 170*eba4d44aSLiu Zhe if(j==4)break; 171*eba4d44aSLiu Zhe } 172*eba4d44aSLiu Zhe 173*eba4d44aSLiu Zhe //reopen the doc document and assert table vertical alignment 174*eba4d44aSLiu Zhe XTextDocument assertDocument_doc=(XTextDocument)UnoRuntime.queryInterface(XTextDocument.class, app.loadDocument(Testspace.getPath("output/test.doc"))); 175*eba4d44aSLiu Zhe XTextTablesSupplier xTablesSupplier_doc = (XTextTablesSupplier) UnoRuntime.queryInterface(XTextTablesSupplier.class, assertDocument_doc ); 176*eba4d44aSLiu Zhe XIndexAccess xIndexedTables_doc = (XIndexAccess) UnoRuntime.queryInterface(XIndexAccess.class, xTablesSupplier_doc.getTextTables()); 177*eba4d44aSLiu Zhe Object xTable_obj_doc=xIndexedTables_doc.getByIndex(0); 178*eba4d44aSLiu Zhe XTextTable xTable_Assert_doc=(XTextTable) UnoRuntime.queryInterface(XTextTable.class, xTable_obj_doc); 179*eba4d44aSLiu Zhe String[] cellName_assert_doc=xTable_Assert_doc.getCellNames(); 180*eba4d44aSLiu Zhe int k=0; 181*eba4d44aSLiu Zhe while(cellName_assert_doc[k] != null) 182*eba4d44aSLiu Zhe { 183*eba4d44aSLiu Zhe XPropertySet xCursorProps_assert_odt = (XPropertySet)UnoRuntime.queryInterface(XPropertySet.class,xTable_Assert_doc.getCellByName(cellName_assert_doc[k])); 184*eba4d44aSLiu Zhe assertEquals("assert table vertical alignment",VertOrientation.CENTER,xCursorProps_assert_odt.getPropertyValue("VertOrient")); 185*eba4d44aSLiu Zhe k++; 186*eba4d44aSLiu Zhe if(k==4)break; 187*eba4d44aSLiu Zhe } 188*eba4d44aSLiu Zhe } 189*eba4d44aSLiu Zhe @Test 190*eba4d44aSLiu Zhe public void testtableVerticalAlignment_Top() throws Exception { 191*eba4d44aSLiu Zhe xTextDocument =(XTextDocument)UnoRuntime.queryInterface(XTextDocument.class, app.newDocument("swriter")); 192*eba4d44aSLiu Zhe xText=xTextDocument.getText(); 193*eba4d44aSLiu Zhe XTextCursor xTextCursor = xText.createTextCursor(); 194*eba4d44aSLiu Zhe // get internal service factory of the document 195*eba4d44aSLiu Zhe xWriterFactory =(XMultiServiceFactory)UnoRuntime.queryInterface(XMultiServiceFactory.class, xTextDocument); 196*eba4d44aSLiu Zhe // Create a new table from the document's factory 197*eba4d44aSLiu Zhe XTextTable xTable = (XTextTable)UnoRuntime.queryInterface(XTextTable.class, xWriterFactory.createInstance("com.sun.star.text.TextTable")); 198*eba4d44aSLiu Zhe xText.insertTextContent(xTextCursor,xTable,false); 199*eba4d44aSLiu Zhe String[] cellName=xTable.getCellNames(); 200*eba4d44aSLiu Zhe int i=0; 201*eba4d44aSLiu Zhe while(cellName[i] != null) 202*eba4d44aSLiu Zhe { 203*eba4d44aSLiu Zhe XPropertySet xCursorProps = (XPropertySet)UnoRuntime.queryInterface(XPropertySet.class,xTable.getCellByName(cellName[i])); 204*eba4d44aSLiu Zhe xCursorProps.setPropertyValue("VertOrient",VertOrientation.TOP); 205*eba4d44aSLiu Zhe i++; 206*eba4d44aSLiu Zhe if(i==4)break; 207*eba4d44aSLiu Zhe } 208*eba4d44aSLiu Zhe //save to odt 209*eba4d44aSLiu Zhe XStorable xStorable_odt = (XStorable) UnoRuntime.queryInterface(XStorable.class, xTextDocument); 210*eba4d44aSLiu Zhe PropertyValue[] aStoreProperties_odt = new PropertyValue[2]; 211*eba4d44aSLiu Zhe aStoreProperties_odt[0] = new PropertyValue(); 212*eba4d44aSLiu Zhe aStoreProperties_odt[1] = new PropertyValue(); 213*eba4d44aSLiu Zhe aStoreProperties_odt[0].Name = "Override"; 214*eba4d44aSLiu Zhe aStoreProperties_odt[0].Value = true; 215*eba4d44aSLiu Zhe aStoreProperties_odt[1].Name = "FilterName"; 216*eba4d44aSLiu Zhe aStoreProperties_odt[1].Value = "StarOffice XML (Writer)"; 217*eba4d44aSLiu Zhe xStorable_odt.storeToURL(FileUtil.getUrl(Testspace.getPath("output/test.odt")), aStoreProperties_odt); 218*eba4d44aSLiu Zhe //save to doc 219*eba4d44aSLiu Zhe XStorable xStorable_doc = (XStorable) UnoRuntime.queryInterface(XStorable.class, xTextDocument); 220*eba4d44aSLiu Zhe PropertyValue[] aStoreProperties_doc = new PropertyValue[2]; 221*eba4d44aSLiu Zhe aStoreProperties_doc[0] = new PropertyValue(); 222*eba4d44aSLiu Zhe aStoreProperties_doc[1] = new PropertyValue(); 223*eba4d44aSLiu Zhe aStoreProperties_doc[0].Name = "Override"; 224*eba4d44aSLiu Zhe aStoreProperties_doc[0].Value = true; 225*eba4d44aSLiu Zhe aStoreProperties_doc[1].Name = "FilterName"; 226*eba4d44aSLiu Zhe aStoreProperties_doc[1].Value = "MS Word 97"; 227*eba4d44aSLiu Zhe xStorable_doc.storeToURL(FileUtil.getUrl(Testspace.getPath("output/test.doc")), aStoreProperties_doc); 228*eba4d44aSLiu Zhe app.closeDocument(xTextDocument); 229*eba4d44aSLiu Zhe 230*eba4d44aSLiu Zhe //reopen the odt document and assert table vertical alignment 231*eba4d44aSLiu Zhe XTextDocument assertDocument_odt=(XTextDocument)UnoRuntime.queryInterface(XTextDocument.class, app.loadDocument(Testspace.getPath("output/test.odt"))); 232*eba4d44aSLiu Zhe XTextTablesSupplier xTablesSupplier_odt = (XTextTablesSupplier) UnoRuntime.queryInterface(XTextTablesSupplier.class, assertDocument_odt ); 233*eba4d44aSLiu Zhe XIndexAccess xIndexedTables_odt = (XIndexAccess) UnoRuntime.queryInterface(XIndexAccess.class, xTablesSupplier_odt.getTextTables()); 234*eba4d44aSLiu Zhe Object xTable_obj_odt=xIndexedTables_odt.getByIndex(0); 235*eba4d44aSLiu Zhe XTextTable xTable_Assert_odt=(XTextTable) UnoRuntime.queryInterface(XTextTable.class, xTable_obj_odt); 236*eba4d44aSLiu Zhe String[] cellName_assert_odt=xTable_Assert_odt.getCellNames(); 237*eba4d44aSLiu Zhe int j=0; 238*eba4d44aSLiu Zhe while(cellName_assert_odt[j] != null) 239*eba4d44aSLiu Zhe { 240*eba4d44aSLiu Zhe XPropertySet xCursorProps_assert_odt = (XPropertySet)UnoRuntime.queryInterface(XPropertySet.class,xTable_Assert_odt.getCellByName(cellName_assert_odt[j])); 241*eba4d44aSLiu Zhe assertEquals("assert table border spacing to content",VertOrientation.TOP,xCursorProps_assert_odt.getPropertyValue("VertOrient")); 242*eba4d44aSLiu Zhe j++; 243*eba4d44aSLiu Zhe if(j==4)break; 244*eba4d44aSLiu Zhe } 245*eba4d44aSLiu Zhe 246*eba4d44aSLiu Zhe //reopen the doc document and assert table vertical alignment 247*eba4d44aSLiu Zhe XTextDocument assertDocument_doc=(XTextDocument)UnoRuntime.queryInterface(XTextDocument.class, app.loadDocument(Testspace.getPath("output/test.doc"))); 248*eba4d44aSLiu Zhe XTextTablesSupplier xTablesSupplier_doc = (XTextTablesSupplier) UnoRuntime.queryInterface(XTextTablesSupplier.class, assertDocument_doc ); 249*eba4d44aSLiu Zhe XIndexAccess xIndexedTables_doc = (XIndexAccess) UnoRuntime.queryInterface(XIndexAccess.class, xTablesSupplier_doc.getTextTables()); 250*eba4d44aSLiu Zhe Object xTable_obj_doc=xIndexedTables_doc.getByIndex(0); 251*eba4d44aSLiu Zhe XTextTable xTable_Assert_doc=(XTextTable) UnoRuntime.queryInterface(XTextTable.class, xTable_obj_doc); 252*eba4d44aSLiu Zhe String[] cellName_assert_doc=xTable_Assert_doc.getCellNames(); 253*eba4d44aSLiu Zhe int k=0; 254*eba4d44aSLiu Zhe while(cellName_assert_doc[k] != null) 255*eba4d44aSLiu Zhe { 256*eba4d44aSLiu Zhe XPropertySet xCursorProps_assert_odt = (XPropertySet)UnoRuntime.queryInterface(XPropertySet.class,xTable_Assert_doc.getCellByName(cellName_assert_doc[k])); 257*eba4d44aSLiu Zhe assertEquals("assert table vertical alignment",VertOrientation.TOP,xCursorProps_assert_odt.getPropertyValue("VertOrient")); 258*eba4d44aSLiu Zhe k++; 259*eba4d44aSLiu Zhe if(k==4)break; 260*eba4d44aSLiu Zhe } 261*eba4d44aSLiu Zhe } 262*eba4d44aSLiu Zhe } 263*eba4d44aSLiu Zhe 264