public void CountSelectShapes() { Workbook wb = Instance.Default.CreateWorkbook(); Worksheet ws = wb.Worksheets.Add(); Shapes shs = ws.Shapes; shs.AddLine(10, 10, 20, 30); shs.AddLine(50, 50, 20, 30); SheetViewModel svm = new SheetViewModel(ws); Assert.AreEqual(0, svm.CountCharts()); Assert.AreEqual(2, svm.CountShapes()); Assert.IsFalse(svm.SelectCharts(), "SelectCharts() should return false if the sheet contains only shapes."); Assert.IsTrue(svm.SelectShapes(), "SelectGraphicObjects() should return true if the sheet contains shapes."); }
public static void CreateSomeShapes(Worksheet worksheet, int number) { Random random = new Random(worksheet.GetHashCode()); Shapes shapes = worksheet.Shapes; for (int n = 0; n < number; n++) { shapes.AddLine(10 + random.Next(30), 10 + random.Next(40), 300 + random.Next(100), 200 + random.Next(50)); } }
public override Bitmap DisplayImage(Shape formatShape) { Shapes shapes = SyncFormatUtil.GetTemplateShapes(); Shape shape = shapes.AddLine( 0, SyncFormatConstants.DisplayImageSize.Height, SyncFormatConstants.DisplayImageSize.Width, 0); SyncFormat(formatShape, shape); Bitmap image = GraphicsUtil.ShapeToBitmap(shape); shape.Delete(); return(image); }
public static Bitmap DisplayImage(Shape formatShape) { Shapes shapes = SyncFormatUtil.GetTemplateShapes(); Shape shape = shapes.AddLine( 0, SyncFormatConstants.DisplayImageSize.Height, SyncFormatConstants.DisplayImageSize.Width, 0); SyncFormat(formatShape, shape); shape.Line.ForeColor.RGB = SyncFormatConstants.ColorBlack; shape.Line.Weight = SyncFormatConstants.DisplayLineWeight; Bitmap image = GraphicsUtil.ShapeToBitmap(shape); shape.Delete(); return(image); }
public void TwoShapesSelection() { Shapes shs = ws.Shapes; Shape sh1 = shs.AddLine(100, 100, 300, 200); Shape sh2 = shs.AddTextbox( Mso.MsoTextOrientation.msoTextOrientationHorizontal, 200, 200, 500, 400); Rect boundingRect = new Rect(100, 100, 600, 500); sh1.Select(true); sh2.Select(false); Rect r = svm.Bounds; Console.WriteLine(r); Assert.AreEqual(boundingRect, r, "Incorrect bounding rectangle for multiple selected shapes."); }