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