public void TestShapes1() { HWPFDocument doc = HWPFTestDataSamples.OpenSampleFile("WithArtShapes.doc"); IList shapes = doc.GetShapesTable().GetAllShapes(); IList vshapes = doc.GetShapesTable().GetVisibleShapes(); Assert.AreEqual(2, shapes.Count); Assert.AreEqual(2, vshapes.Count); Shape s1 = (Shape)shapes[0]; Shape s2 = (Shape)shapes[1]; Assert.AreEqual(3616, s1.Width); Assert.AreEqual(1738, s1.Height); Assert.AreEqual(true, s1.IsWithinDocument); Assert.AreEqual(4817, s2.Width); Assert.AreEqual(2164, s2.Height); Assert.AreEqual(true, s2.IsWithinDocument); // Re-serialisze, check still there MemoryStream baos = new MemoryStream(); doc.Write(baos); MemoryStream bais = new MemoryStream(baos.ToArray()); doc = new HWPFDocument(bais); shapes = doc.GetShapesTable().GetAllShapes(); vshapes = doc.GetShapesTable().GetVisibleShapes(); Assert.AreEqual(2, shapes.Count); Assert.AreEqual(2, vshapes.Count); s1 = (Shape)shapes[0]; s2 = (Shape)shapes[1]; Assert.AreEqual(3616, s1.Width); Assert.AreEqual(1738, s1.Height); Assert.AreEqual(true, s1.IsWithinDocument); Assert.AreEqual(4817, s2.Width); Assert.AreEqual(2164, s2.Height); Assert.AreEqual(true, s2.IsWithinDocument); }