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