コード例 #1
0
        public static void Run()
        {
            //Source directory
            string sourceDir = RunExamples.Get_SourceDirectory();

            //Output directory
            string outputDir = RunExamples.Get_OutputDirectory();

            // Open the template file
            Workbook workbook = new Workbook(sourceDir + "sampleCopyChart.xlsx");

            Worksheet worksheet = workbook.Worksheets[0];

            // Get the Chart from the "Chart" worksheet.
            Aspose.Cells.Charts.Chart source = worksheet.Charts[0];

            Aspose.Cells.Drawing.ChartShape cshape = source.ChartObject;

            // Copy the Chart to the Result Worksheet
            worksheet.Shapes.AddCopy(cshape, 4, 0, 8, 0);

            // Save the Worksheet
            workbook.Save(outputDir + "outputCopyChart.xlsx");

            Console.WriteLine("CopyChart executed successfully.");
        }
コード例 #2
0
        public static void Run()
        {
            //Source directory
            string sourceDir = RunExamples.Get_SourceDirectory();

            //Output directory
            string outputDir = RunExamples.Get_OutputDirectory();

            // Open the template file
            Workbook workbook = new Workbook(sourceDir + "sampleCopyShapesBetweenWorksheets.xlsx");

            // Get the Picture from the "Picture" worksheet.
            Aspose.Cells.Drawing.Picture picturesource = workbook.Worksheets["Picture"].Pictures[0];

            // Save Picture to Memory Stream
            MemoryStream ms = new MemoryStream(picturesource.Data);

            // Copy the picture to the Result Worksheet
            workbook.Worksheets["Result"].Pictures.Add(picturesource.UpperLeftRow, picturesource.UpperLeftColumn, ms, picturesource.WidthScale, picturesource.HeightScale);

            // Save the Worksheet
            workbook.Save(outputDir + "outputCopyShapesBetweenWorksheets_Picture.xlsx");

            //-----------------------------------
            //-----------------------------------

            // Open the template file
            workbook = new Workbook(sourceDir + "sampleCopyShapesBetweenWorksheets.xlsx");

            // Get the Chart from the "Chart" worksheet.
            Aspose.Cells.Charts.Chart chartsource = workbook.Worksheets["Chart"].Charts[0];

            Aspose.Cells.Drawing.ChartShape cshape = chartsource.ChartObject;

            // Copy the Chart to the Result Worksheet
            workbook.Worksheets["Result"].Shapes.AddCopy(cshape, 5, 0, 2, 0);

            // Save the Worksheet
            workbook.Save(outputDir + "outputCopyShapesBetweenWorksheets_Chart.xlsx");

            //-----------------------------------
            //-----------------------------------

            // Open the template file
            workbook = new Workbook(sourceDir + "sampleCopyShapesBetweenWorksheets.xlsx");

            // Get the Shapes from the "Control" worksheet.
            Aspose.Cells.Drawing.ShapeCollection shape = workbook.Worksheets["Control"].Shapes;

            // Copy the Textbox to the Result Worksheet
            workbook.Worksheets["Result"].Shapes.AddCopy(shape[0], 5, 0, 2, 0);

            // Save the Worksheet
            workbook.Save(outputDir + "outputCopyShapesBetweenWorksheets_Control.xlsx");

            Console.WriteLine("CopyShapesBetweenWorksheets executed successfully.");
        }
コード例 #3
0
        public static void Run()
        {
            // ExStart:CopyPictureBetweenWorksheets
            // The path to the documents directory.
            string dataDir = RunExamples.GetDataDir(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType);

            // Open the template file
            Workbook workbook = new Workbook(dataDir + "sample.xlsx");

            // Get the Picture from the "Picture" worksheet.
            Aspose.Cells.Drawing.Picture picturesource = workbook.Worksheets["Picture"].Pictures[0];

            // Save Picture to Memory Stream
            MemoryStream ms = new MemoryStream(picturesource.Data);

            // Copy the picture to the Result Worksheet
            workbook.Worksheets["Result"].Pictures.Add(picturesource.UpperLeftRow, picturesource.UpperLeftColumn, ms, picturesource.WidthScale, picturesource.HeightScale);

            // Save the Worksheet
            workbook.Save(dataDir + "PictureCopied_out.xlsx");
            // ExEnd:CopyPictureBetweenWorksheets

            // ExStart:CopyChartBetweenWorksheets
            // Get the Chart from the "Chart" worksheet.
            Aspose.Cells.Charts.Chart chartsource = workbook.Worksheets["Chart"].Charts[0];

            Aspose.Cells.Drawing.ChartShape cshape = chartsource.ChartObject;

            // Copy the Chart to the Result Worksheet
            workbook.Worksheets["Result"].Shapes.AddCopy(cshape, 20, 0, 2, 0);

            // Save the Worksheet
            workbook.Save(dataDir + "ChartCopied_out.xlsx");
            // ExEnd:CopyChartBetweenWorksheets

            // ExStart:CopyControlsAndOtherDrawingObjects
            // Open the template file
            workbook = new Workbook(dataDir + "sample2.xlsx");

            // Get the Shapes from the "Control" worksheet.
            Aspose.Cells.Drawing.ShapeCollection shape = workbook.Worksheets["Control"].Shapes;

            // Copy the Textbox to the Result Worksheet
            workbook.Worksheets["Result"].Shapes.AddCopy(shape[0], 5, 0, 2, 0);

            // Copy the Oval Shape to the Result Worksheet
            workbook.Worksheets["Result"].Shapes.AddCopy(shape[1], 10, 0, 2, 0);

            // Save the Worksheet
            workbook.Save(dataDir + "ControlsCopied_out.xlsx");
            // ExEnd:CopyControlsAndOtherDrawingObjects
        }
コード例 #4
0
ファイル: Program.cs プロジェクト: estoy/Aspose_Cells_NET
        static void Main(string[] args)
        {
            //Create a workbook object
            //Open the template file
            Workbook workbook = new Workbook("Shapes.xls");

            //Get the Chart from the "Chart" worksheet.
            Aspose.Cells.Charts.Chart source = workbook.Worksheets["Chart"].Charts[0];

            Aspose.Cells.Drawing.ChartShape cshape = source.ChartObject;

            //Copy the Chart to the Result Worksheet
            workbook.Worksheets["Result"].Shapes.AddCopy(cshape, 20, 0, 2, 0);

            //Save the Worksheet
            workbook.Save("Shapes.xls");
        }
コード例 #5
0
        public static void Main()
        {
            // The path to the documents directory.
            string dataDir = Path.GetFullPath("../../../Data/");
            //Create a workbook object
            //Open the template file
            Workbook workbook = new Workbook(dataDir + "aspose-sample.xlsx");

            //Get the Chart from the "Chart" worksheet.
            Aspose.Cells.Charts.Chart source = workbook.Worksheets["Sheet2"].Charts[0];

            Aspose.Cells.Drawing.ChartShape cshape = source.ChartObject;

            //Copy the Chart to the Result Worksheet
            workbook.Worksheets["Sheet3"].Shapes.AddCopy(cshape, 20, 0, 2, 0);

            //Save the Worksheet
            workbook.Save(dataDir + "Shapes.xlsx");
        }
コード例 #6
0
ファイル: Program.cs プロジェクト: schummi/Aspose_for_OpenXML
        static void Main(string[] args)
        {
            string FilePath = @"..\..\..\Sample Files\";
            string FileName = FilePath + "Copy Shapes between Worksheets.xlsx";

            //Open the template file
            Workbook workbook = new Workbook(FileName);

            //Get the Chart from the "Chart" worksheet.
            Aspose.Cells.Charts.Chart source = workbook.Worksheets["Chart"].Charts[0];

            Aspose.Cells.Drawing.ChartShape cshape = source.ChartObject;

            //Copy the Chart to the Result Worksheet
            workbook.Worksheets["Result"].Shapes.AddCopy(cshape, 20, 0, 2, 0);

            //Save the Worksheet
            workbook.Save(FileName);
        }
コード例 #7
0
        public static void Run()
        {
            // ExStart:1
            // The path to the documents directory.
            string dataDir = RunExamples.GetDataDir(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType);
            // Create a workbook object
            // Open the template file
            Workbook workbook = new Workbook(dataDir + "aspose-sample.xlsx");

            // Get the Chart from the "Chart" worksheet.
            Aspose.Cells.Charts.Chart source = workbook.Worksheets["Sheet2"].Charts[0];

            Aspose.Cells.Drawing.ChartShape cshape = source.ChartObject;

            // Copy the Chart to the Result Worksheet
            workbook.Worksheets["Sheet3"].Shapes.AddCopy(cshape, 20, 0, 2, 0);

            // Save the Worksheet
            workbook.Save(dataDir + "Shapes.out.xlsx");
            // ExEnd:1
        }