public override void Execute(GrapeCity.Documents.Excel.Workbook workbook)
        {
            object[,] data = new object[, ] {
                { "Name", "City", "Birthday", "Sex", "Weight", "Height" },
                { "Bob", "NewYork", new DateTime(1968, 6, 8), "male", 80, 180 },
                { "Betty", "NewYork", new DateTime(1972, 7, 3), "female", 72, 168 },
                { "Gary", "NewYork", new DateTime(1964, 3, 2), "male", 71, 179 },
                { "Hunk", "Washington", new DateTime(1972, 8, 8), "male", 80, 171 },
                { "Cherry", "Washington", new DateTime(1986, 2, 2), "female", 58, 161 },
                { "Eva", "Washington", new DateTime(1993, 2, 5), "female", 71, 180 }
            };

            //Set data.
            IWorksheet sheet = workbook.Worksheets[0];

            sheet.Range["A1:F7"].Value = data;
            sheet.Tables.Add(sheet.Range["A1:F7"], true);

            //Save csv options
            CsvSaveOptions options = new CsvSaveOptions();

            options.SeparatorString = "-";

            //Change the path to real export path when save.
            workbook.Save(this.CurrentDirectory + "dest.csv", options);
        }
Esempio n. 2
0
        public override void Execute(GrapeCity.Documents.Excel.Workbook workbook)
        {
            //Change the path to real export path when save.
            XlsxSaveOptions options = new XlsxSaveOptions();

            options.Password = "******";

            workbook.Save(this.CurrentDirectory + "dest.xlsx", options);
        }
Esempio n. 3
0
        public override void Execute(GrapeCity.Documents.Excel.Workbook workbook)
        {
            IWorksheet sheet = workbook.Worksheets[0];

            //set style.
            sheet.Range["A1"].Value          = "Sheet1";
            sheet.Range["A1"].Font.Name      = "Wide Latin";
            sheet.Range["A1"].Font.Color     = Color.Red;
            sheet.Range["A1"].Interior.Color = Color.Green;

            //change the path to real export path when save.
            workbook.Save(this.CurrentDirectory + "dest.pdf", SaveFileFormat.Pdf);
        }
Esempio n. 4
0
        public void DioDocs()
        {
            var workbook  = new Workbook();
            var worksheet = workbook.ActiveSheet;

            for (var i = 1; i <= ColumnNum; i++)
            {
                for (var j = 1; j <= RowNum; j++)
                {
                    worksheet.Range[i, j].Value = "Hello World!";
                }
            }

            workbook.Save(Stream.Null);
        }
Esempio n. 5
0
        public override void Execute(GrapeCity.Documents.Excel.Workbook workbook)
        {
            //ToJson&FromJson can be used in combination with spread.sheets product:http://spread.grapecity.com/spreadjs/sheets/

            //GrapeCity Documents for Excel import an excel file.
            //change the path to real source file path.
            string source = this.CurrentDirectory + "source.xlsx";

            workbook.Open(source);
            //GrapeCity Documents for Excel export to a json string.
            var jsonstr = workbook.ToJson();

            //use the json string to initialize spread.sheets product.
            //spread.sheets will show the excel file contents.

            //spread.sheets product export a json string.
            //GrapeCity Documents for Excel use the json string to initialize.
            workbook.FromJson(jsonstr);
            //GrapeCity Documents for Excel export workbook to an excel file.
            //change the path to real export file path.
            string export = this.CurrentDirectory + "export.xlsx";

            workbook.Save(export);
        }
Esempio n. 6
0
 public override void Execute(GrapeCity.Documents.Excel.Workbook workbook)
 {
     //change the path to real export path when save.
     workbook.Save(this.CurrentDirectory + "dest.xlsx", SaveFileFormat.Xlsx);
 }