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