public static void Main()
        {
            //Load sample Excel file.
            Workbook wb = new Workbook(sourceDir + "sampleRotateTextWithShapeInsideWorksheet.xlsx");

            //Access first worksheet.
            Worksheet ws = wb.Worksheets[0];

            //Access cell B4 and add message inside it.
            Cell b4 = ws.Cells["B4"];

            b4.PutValue("Text is not rotating with shape because RotateTextWithShape is false.");

            //Access first shape.
            Shape sh = ws.Shapes[0];

            //Access shape text alignment.
            Aspose.Cells.Drawing.Texts.ShapeTextAlignment shapeTextAlignment = sh.TextBody.TextAlignment;

            //Do not rotate text with shape by setting RotateTextWithShape as false.
            shapeTextAlignment.RotateTextWithShape = false;

            //Save the output Excel file.
            wb.Save(outputDir + "outputRotateTextWithShapeInsideWorksheet.xlsx");

            Console.WriteLine("RotateTextWithShapeInsideWorksheet executed successfully.");
        }
예제 #2
0
        public static void Run()
        {
            //Load the sample Excel file
            Workbook wb = new Workbook(sourceDir + "sampleSetMarginsOfCommentOrShapeInsideTheWorksheet.xlsx");

            //Access first worksheet
            Worksheet ws = wb.Worksheets[0];

            foreach (Shape sh in ws.Shapes)
            {
                //Access the text alignment
                Aspose.Cells.Drawing.Texts.ShapeTextAlignment txtAlign = sh.TextBody.TextAlignment;

                //Set auto margin false
                txtAlign.IsAutoMargin = false;

                //Set the top, left, bottom and right margins
                txtAlign.TopMarginPt    = 10;
                txtAlign.LeftMarginPt   = 10;
                txtAlign.BottomMarginPt = 10;
                txtAlign.RightMarginPt  = 10;
            }

            //Save the output Excel file
            wb.Save(outputDir + "outputSetMarginsOfCommentOrShapeInsideTheWorksheet.xlsx");

            Console.WriteLine("SetMarginsOfCommentOrShapeInsideTheWorksheet executed successfully.");
        }