Esempio n. 1
0
        public static void Run()
        {
            // ExStart:1
            CellsApi   cellsApi   = new CellsApi(Common.APP_KEY, Common.APP_SID, Common.BASEPATH);
            StorageApi storageApi = new StorageApi(Common.APP_KEY, Common.APP_SID, Common.BASEPATH);

            String fileName   = "Sample_Test_Book.xls";
            String sheetName  = "Sheet5";
            int    chartIndex = 0;
            String storage    = "";
            String folder     = "";

            try
            {
                // Upload source file to aspose cloud storage
                storageApi.PutCreate(fileName, "", "", System.IO.File.ReadAllBytes(Common.GetDataDir() + fileName));

                // Invoke Aspose.Cells Cloud SDK API to get fill format of chart area from worksheet
                FillFormatResponse apiResponse = cellsApi.GetChartAreaFillFormat(fileName, sheetName, chartIndex, storage, folder);

                if (apiResponse != null && apiResponse.Status.Equals("OK"))
                {
                    FillFormat chartAreaFillFormat = apiResponse.FillFormat;
                    Console.WriteLine("ChatArea FillFormat Type :: " + chartAreaFillFormat.Type);
                    Console.ReadKey();
                }
            }
            catch (Exception ex)
            {
                System.Diagnostics.Debug.WriteLine("error:" + ex.Message + "\n" + ex.StackTrace);
            }
            // ExEnd:1
        }
Esempio n. 2
0
        public static void Run()
        {
            //Output directory
            string outputDir = RunExamples.Get_OutputDirectory();

            // Instantiate a new Workbook
            Workbook workbook = new Workbook();

            // Get the first default sheet
            Worksheet sheet = workbook.Worksheets[0];

            // Add Watermark
            Aspose.Cells.Drawing.Shape wordart = sheet.Shapes.AddTextEffect(MsoPresetTextEffect.TextEffect1,
                                                                            "CONFIDENTIAL", "Arial Black", 50, false, true
                                                                            , 18, 8, 1, 1, 130, 800);

            // Get the fill format of the word art
            FillFormat wordArtFormat = wordart.Fill;

            // Set the transparency
            wordArtFormat.Transparency = 0.9;

            // Make the line invisible
            LineFormat lineFormat = wordart.Line;

            // Save the file
            workbook.Save(outputDir + "outputAddWordArtWatermarkToWorksheet.xlsx");

            Console.WriteLine("AddWordArtWatermarkToWorksheet executed successfully.\r\n");
        }
        public static void Run()
        {
            // ExStart:AddWordArtWatermarkToChart
            // The path to the documents directory.
            string dataDir = RunExamples.GetDataDir(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType);

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

            // Get the chart in the first worksheet.
            Aspose.Cells.Charts.Chart chart = workbook.Worksheets[0].Charts[0];

            // Add a WordArt watermark (shape) to the chart's plot area.
            Aspose.Cells.Drawing.Shape wordart = chart.Shapes.AddTextEffectInChart(MsoPresetTextEffect.TextEffect2,
                                                                                   "CONFIDENTIAL", "Arial Black", 66, false, false, 1200, 500, 2000, 3000);

            // Get the shape's fill format.
            FillFormat wordArtFormat = wordart.Fill;

            // Set the transparency.
            wordArtFormat.Transparency = 0.9;

            // Get the line format.
            LineFormat lineFormat = wordart.Line;

            // Set Line format to invisible.
            lineFormat.Weight = 0.0;

            // Save the excel file.
            workbook.Save(dataDir + "output_out_.xlsx");
            // ExEnd:AddWordArtWatermarkToChart
        }
        public static void Run()
        {
            //Source directory
            string sourceDir = RunExamples.Get_SourceDirectory();

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

            // Open the existing excel file.
            Workbook workbook = new Workbook(sourceDir + "sampleAddWordArtWatermarkToChart.xlsx");

            // Get the chart in the first worksheet.
            Aspose.Cells.Charts.Chart chart = workbook.Worksheets[0].Charts[0];

            // Add a WordArt watermark (shape) to the chart's plot area.
            Aspose.Cells.Drawing.Shape wordart = chart.Shapes.AddTextEffectInChart(MsoPresetTextEffect.TextEffect2,
                                                                                   "CONFIDENTIAL", "Arial Black", 66, false, false, 1200, 500, 2000, 3000);

            // Get the shape's fill format.
            FillFormat wordArtFormat = wordart.Fill;

            // Set the transparency.
            wordArtFormat.Transparency = 0.9;

            // Get the line format.
            LineFormat lineFormat = wordart.Line;

            // Set Line format to invisible.
            lineFormat.Weight = 0.0;

            // Save the excel file.
            workbook.Save(outputDir + "outputAddWordArtWatermarkToChart.xlsx");

            Console.WriteLine("AddWordArtWatermarkToChart executed successfully.");
        }
Esempio n. 5
0
 /// <summary>
 /// Creates a XBrush based on the specified fill format. If not specified, color will be taken
 /// from the defaultColor parameter.
 /// </summary>
 internal static XBrush ToXBrush(FillFormat fillFormat, XColor defaultColor)
 {
     if (fillFormat == null || fillFormat._color.IsEmpty)
     {
         return(new XSolidBrush(defaultColor));
     }
     return(new XSolidBrush(fillFormat._color));
 }
Esempio n. 6
0
        public MockShape(Microsoft.Office.Core.MsoShapeType type = Microsoft.Office.Core.MsoShapeType.msoTextBox, int z = 1)
        {
            this.textEffect = new MockTextEffectFormat();
            this.textFrame  = new MockTextFrame2();
            this.fill       = new MockFillFormat();
            this.type       = type; //default = tb
            this.z          = 1;

            this.id = Int32.Parse(Settings.NextRandomValue().Split('-')[0]);
        }
Esempio n. 7
0
        protected void syncFill(string shapeToCopy, int expectedSlideNo)
        {
            Microsoft.Office.Interop.PowerPoint.Shape formatShape = GetShape(OriginalShapesSlideNo, shapeToCopy);

            Microsoft.Office.Interop.PowerPoint.Shape newShape = GetShape(OriginalShapesSlideNo, CopyToShape);
            FillFormat.SyncFormat(formatShape, newShape);

            CompareSlides(OriginalShapesSlideNo, expectedSlideNo);
            CheckTransparency(CopyToShape, OriginalShapesSlideNo, expectedSlideNo);
        }
Esempio n. 8
0
        public MockShape(Microsoft.Office.Core.MsoShapeType type = Microsoft.Office.Core.MsoShapeType.msoTextBox,int z = 1)
        {
            this.textEffect = new MockTextEffectFormat();
            this.textFrame = new MockTextFrame2();
            this.fill = new MockFillFormat();
            this.type = type; //default = tb
            this.z = 1;

            this.id = Int32.Parse(Settings.NextRandomValue().Split('-')[0]);
        }
Esempio n. 9
0
        protected void syncFill(string shapeToCopy, int expectedSlideNo)
        {
            var formatShape = GetShape(OriginalShapesSlideNo, shapeToCopy);

            var newShape = GetShape(OriginalShapesSlideNo, CopyToShape);

            FillFormat.SyncFormat(formatShape, newShape);

            CompareSlides(OriginalShapesSlideNo, expectedSlideNo);
            CheckTransparency(CopyToShape, OriginalShapesSlideNo, expectedSlideNo);
        }
Esempio n. 10
0
        internal ShapeRenderer(XGraphics gfx, RenderInfo renderInfo, FieldInfos fieldInfos)
            : base(gfx, renderInfo, fieldInfos)
        {
            this.shape = (Shape)renderInfo.DocumentObject;
            LineFormat lf = (LineFormat)this.shape.GetValue("LineFormat", GV.ReadOnly);

            this.lineFormatRenderer = new LineFormatRenderer(lf, gfx);
            FillFormat ff = (FillFormat)this.shape.GetValue("FillFormat", GV.ReadOnly);

            this.fillFormatRenderer = new FillFormatRenderer(ff, gfx);
        }
Esempio n. 11
0
        /// <summary>
        /// Renders the fill format of the shape.
        /// </summary>
        protected void RenderFillFormat()
        {
            FillFormat ff = GetValueAsIntended("FillFormat") as FillFormat;

            if (ff != null && (ff.IsNull("Visible") || ff.Visible == true))
            {
                RenderNameValuePair("fFilled", "1");
                TranslateAsNameValuePair("FillFormat.Color", "fillColor", RtfUnit.Undefined, null);
            }
            else
            {
                RenderNameValuePair("fFilled", "0");
            }
        }
Esempio n. 12
0
        void MapObject(FillFormat fillFormat, MigraDoc.DocumentObjectModel.Shapes.FillFormat domFillFormat)
        {
            if (domFillFormat.Color.IsEmpty)
            {
                fillFormat.Color = XColor.Empty;
            }
            else
            {
#if noCMYK
                fillFormat.Color = XColor.FromArgb((int)domFillFormat.Color.Argb);
#else
                fillFormat.Color = ColorHelper.ToXColor(domFillFormat.Color, domFillFormat.Document.UseCmykColor);
#endif
            }
            fillFormat.Visible = domFillFormat.Visible;
        }
Esempio n. 13
0
        public static void Run()
        {
            // ExStart:1
            // The path to the documents directory.
            string dataDir = RunExamples.GetDataDir(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType);

            // Create directory if it is not already present.
            bool IsExists = System.IO.Directory.Exists(dataDir);

            if (!IsExists)
            {
                System.IO.Directory.CreateDirectory(dataDir);
            }

            // Instantiate a new Workbook
            Workbook workbook = new Workbook();

            // Get the first default sheet
            Worksheet sheet = workbook.Worksheets[0];

            // Add Watermark
            Aspose.Cells.Drawing.Shape wordart = sheet.Shapes.AddTextEffect(MsoPresetTextEffect.TextEffect1,
                                                                            "CONFIDENTIAL", "Arial Black", 50, false, true
                                                                            , 18, 8, 1, 1, 130, 800);

            // Get the fill format of the word art
            FillFormat wordArtFormat = wordart.Fill;

            // Set the transparency
            wordArtFormat.Transparency = 0.9;

            // Make the line invisible
            LineFormat lineFormat = wordart.Line;

            dataDir = dataDir + "Watermark_Test.out.xls";
            // Save the file
            workbook.Save(dataDir);
            // ExEnd:1

            Console.WriteLine("\nProcess completed successfully.\nFile saved at " + dataDir);
        }
        public static void Run()
        {
            // ExStart:LockingWordartWatermark
            // The path to the documents directory.
            string dataDir = RunExamples.GetDataDir(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType);

            // Instantiate a new Workbook
            Workbook workbook = new Workbook();

            // Get the first default sheet
            Worksheet sheet = workbook.Worksheets[0];

            // Add Watermark
            Shape wordart = sheet.Shapes.AddTextEffect(MsoPresetTextEffect.TextEffect1,
                                                       "CONFIDENTIAL", "Arial Black", 50, false, true
                                                       , 18, 8, 1, 1, 130, 800);

            // Lock Shape Aspects
            wordart.IsLocked = true;
            wordart.SetLockedProperty(ShapeLockType.Selection, true);
            wordart.SetLockedProperty(ShapeLockType.ShapeType, true);
            wordart.SetLockedProperty(ShapeLockType.Move, true);
            wordart.SetLockedProperty(ShapeLockType.Resize, true);
            wordart.SetLockedProperty(ShapeLockType.Text, true);

            // Get the fill format of the word art
            FillFormat wordArtFormat = wordart.Fill;

            // Set the color
            wordArtFormat.SetOneColorGradient(Color.Red, 0.2, GradientStyleType.Horizontal, 2);

            // Set the transparency
            wordArtFormat.Transparency = 0.9;

            // Make the line invisible
            wordart.HasLine = false;

            // Save the file
            workbook.Save(dataDir + "output_out.xlsx");
            // ExEnd:LockingWordartWatermark
        }
Esempio n. 15
0
 /// <summary>
 /// Creates a XBrush based on the specified fill format. If not specified, color will be taken
 /// from the defaultColor parameter.
 /// </summary>
 internal static XBrush ToXBrush(FillFormat fillFormat, XColor defaultColor) => fillFormat == null || fillFormat._color.IsEmpty ? new XSolidBrush(defaultColor) : new XSolidBrush(fillFormat._color);
Esempio n. 16
0
        internal static void Map(FillFormat fillFormat, MigraDoc.DocumentObjectModel.Shapes.FillFormat domFillFormat)
        {
            FillFormatMapper mapper = new FillFormatMapper();

            mapper.MapObject(fillFormat, domFillFormat);
        }
Esempio n. 17
0
 public FillFormatWrapper(FillFormat model) : base(model)
 {
 }
 public FillFormatRenderer(FillFormat fillFormat, XGraphics gfx)
 {
     this.gfx        = gfx;
     this.fillFormat = fillFormat;
 }
        public static void Map(FillFormat fillFormat, DocumentObjectModel.Shapes.FillFormat domFillFormat)
        {
            FillFormatMapper mapper = new FillFormatMapper();

            mapper.MapObject(fillFormat, domFillFormat);
        }
Esempio n. 20
0
 /// <summary>
 /// Creates a XBrush based on the specified fill format. If not specified, color will be taken
 /// from the defaultColor parameter.
 /// </summary>
 internal static XBrush ToXBrush(FillFormat fillFormat, XColor defaultColor)
 {
   if (fillFormat == null || fillFormat.color.IsEmpty)
     return new XSolidBrush(defaultColor);
   return new XSolidBrush(fillFormat.color);
 }
Esempio n. 21
0
 protected void FlattenFillFormat(FillFormat fillFormat)
 {
 }
 public FillFormatRenderer(FillFormat fillFormat, XGraphics gfx)
 {
     _gfx        = gfx;
     _fillFormat = fillFormat;
 }