当前位置: 首页>>代码示例>>C#>>正文


C# SpreadSheet.Worksheet类代码示例

本文整理汇总了C#中ExcelLibrary.SpreadSheet.Worksheet的典型用法代码示例。如果您正苦于以下问题:C# Worksheet类的具体用法?C# Worksheet怎么用?C# Worksheet使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


Worksheet类属于ExcelLibrary.SpreadSheet命名空间,在下文中一共展示了Worksheet类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: newNToolStripMenuItem_Click

 private void newNToolStripMenuItem_Click(object sender, EventArgs e)
 {
     //test create xls file
     string file = "C:\\newdoc.xls";
     Workbook workbook = new Workbook();
     Worksheet worksheet = new Worksheet("First Sheet");
     worksheet.Cells[0, 1] = new Cell((short)1);
     worksheet.Cells[2, 0] = new Cell(2.8);
     worksheet.Cells[3, 3] = new Cell((decimal)3.45);
     worksheet.Cells[2, 2] = new Cell("Text string");
     worksheet.Cells[2, 4] = new Cell("Second string");
     worksheet.Cells[4, 0] = new Cell(32764.5, "#,##0.00");
     worksheet.Cells[5, 1] = new Cell(DateTime.Now, @"YYYY\-MM\-DD");
     worksheet.Cells.ColumnWidth[0, 1] = 3000;
     //Picture pic = new Picture();
     //pic.Image = Excel.Image.FromFile("C:\\DelBreakpoint.png");
     //pic.TopLeftCorner = new CellAnchor(5, 1, 0, 0);
     //pic.BottomRightCorner = new CellAnchor(12, 5, 592, 243);
     //worksheet.AddPicture(pic);
     workbook.Worksheets.Add(worksheet);
     workbook.Save(file);
     //open created file
     doc = CompoundDocument.Open(file);
     IsOpened = true;
     PopulateTreeview(file);
 }
开发者ID:ErhanKaraca,项目名称:excellibrary,代码行数:26,代码来源:Form1.cs

示例2: WriteLongTextTest

        public void WriteLongTextTest()
        {
            int longTextLength = 50000;

            StringBuilder builder = new StringBuilder(longTextLength);
            for (int i = 0; i < longTextLength; i++)
                builder.Append('A');

            string longText = builder.ToString();

            string tempFilePath = Path.GetTempFileName();
            {
                Workbook workbook = new Workbook();
                Worksheet worksheet = new Worksheet("Test");
                worksheet.Cells[0, 0] = new Cell(longText);

                workbook.Worksheets.Add(worksheet);
                workbook.Save(tempFilePath);
            }

            {
                Workbook workbook = Workbook.Load(tempFilePath);
                Assert.AreEqual(longText, workbook.Worksheets[0].Cells[0, 0].Value);
            }
        }
开发者ID:ErhanKaraca,项目名称:excellibrary,代码行数:25,代码来源:SimpleTest.cs

示例3: EnteteOPR11Ligne2

        public Worksheet EnteteOPR11Ligne2(Worksheet worksheet)
        {
            worksheet.Cells[1, 0] = new Cell("OPR 11");
            worksheet.Cells[1, 1] = new Cell("OT Report");

            return worksheet;
        }
开发者ID:aymenxp,项目名称:Application-ADP-Harmonized,代码行数:7,代码来源:EnteteSGR.cs

示例4: EnteteOPR17Ligne2

        public Worksheet EnteteOPR17Ligne2(Worksheet worksheet)
        {
            worksheet.Cells[1, 0] = new Cell("OPR 17");
            worksheet.Cells[1, 1] = new Cell("Payroll summary");

            return worksheet;
        }
开发者ID:aymenxp,项目名称:Application-ADP-Harmonized,代码行数:7,代码来源:EnteteSGR.cs

示例5: ExportToExcel

    public static void ExportToExcel(DataSet dataSet, string outputPath)
    {
        Workbook workbook = new Workbook();
        foreach (DataTable dt in dataSet.Tables)
        {
            Worksheet worksheet = new Worksheet(dt.TableName);
            for (int i = 0; i < dt.Columns.Count; i++)
            {
                // Add column header
                worksheet.Cells[0, i] = new Cell(dt.Columns[i].ColumnName);

                // Populate row data
                for (int j = 0; j < dt.Rows.Count; j++)
                {
                    if (dt.Rows[j][i] == DBNull.Value)
                        worksheet.Cells[j + 1, i] = new Cell(string.Empty);
                    else
                        if (dt.Columns[i].DataType == typeof(DateTime))
                        {
                            worksheet.Cells[j + 1, i] = new Cell(dt.Rows[j][i], new CellFormat(CellFormatType.Date, "DD.MM.YYYY"));
                        }
                        else
                            worksheet.Cells[j + 1, i] = new Cell(dt.Rows[j][i]);
                }
            }
            workbook.Worksheets.Add(worksheet);
        }
        workbook.Save(outputPath);
    }
开发者ID:alexsharoff,项目名称:avstools,代码行数:29,代码来源:DataSetToExcel.cs

示例6: EnteteOPR15Ligne2

        public Worksheet EnteteOPR15Ligne2(Worksheet worksheet)
        {
            worksheet.Cells[1, 0] = new Cell("OPR 15");
            worksheet.Cells[1, 1] = new Cell("FINANCIAL REPORT");

            return worksheet;
        }
开发者ID:aymenxp,项目名称:Application-ADP-Harmonized,代码行数:7,代码来源:EnteteSGR.cs

示例7: SimpleMultipleSheetTest

        public void SimpleMultipleSheetTest()
        {
            int worksheetToCreate = 10;

            string tempFilePath = Path.GetTempFileName();
            {
                Workbook workbook = new Workbook();
                for (int i = 0; i < worksheetToCreate; i++)
                {
                    Worksheet worksheetWrite2 = new Worksheet(String.Format("Sheet {0}", i));
                    workbook.Worksheets.Add(worksheetWrite2);
                }

                workbook.Save(tempFilePath);
            }

            {
                Workbook workbook = Workbook.Load(tempFilePath);

                Assert.AreEqual(worksheetToCreate, workbook.Worksheets.Count);
                for (int i = 0; i < worksheetToCreate; i++)
                {
                    Assert.AreEqual(String.Format("Sheet {0}", i), workbook.Worksheets[i].Name);
                }
            }
        }
开发者ID:Erls-Corporation,项目名称:excellibrary,代码行数:26,代码来源:SimpleTest.cs

示例8: EcritureC

     public void EcritureC(int idSoc, Worksheet worksheet, int MoisPe, int AnneePe)
     {
 //        if (idSoc == 2)
 //        {
             worksheet = entete.EnteteSVRLigne14(worksheet, idSoc, MoisPe, AnneePe);
 //        }
     }
开发者ID:aymenxp,项目名称:Application-ADP-Harmonized,代码行数:7,代码来源:TraitementSVR.cs

示例9: excel_batch_template

        public static void excel_batch_template(WSProject p)
        {
            string file = @"C:\Users\WindSim\Desktop\Francesco\WindSim_Projects\MoninObukhov\batch.xls";
            Workbook workbook = new Workbook();
            Worksheet worksheet = new Worksheet("Batch Data");

            // this cycle add some null cells because when on Windows 7 Office need at least 6000byte files.
            //----------------------------------------------
            for (var k = 0; k < 200; k++)
                worksheet.Cells[k, 0] = new Cell(null);
            // ---------------------------------------------

            XmlReader reader = XmlReader.Create(p.file.FullName);
            int i = 0;
            while (reader.Read())
            {
                if (reader.NodeType == XmlNodeType.EndElement)
                {
                    worksheet.Cells[i, 0] = new Cell(reader.Name);
                    if (reader.Read())
                    {
                        worksheet.Cells[i, 1] = new Cell(reader.Value.Trim());

                    }
                    i++;
                }
            }

            workbook.Worksheets.Add(worksheet);

            workbook.Save(file);
        }
开发者ID:fparaggio,项目名称:WindSimBattery,代码行数:32,代码来源:Tools.cs

示例10: FileGen

        //private DocumentService documentService =new DocumentService();
        public static string FileGen(string fileName,List<List<string>> sheet )
        {
            if (!Directory.Exists(Constants.ImportTempFolder))
                Directory.CreateDirectory(Constants.ImportTempFolder);
            string file = Constants.ImportTempFolder+fileName;
            if (File.Exists(file))
            {
                try
                {
                    File.Delete(file);
                }
                catch (Exception)
                {

                    return null;
                }
            }
            Workbook workbook = new Workbook();
            Worksheet worksheet = new Worksheet("First Sheet");
            for (int row=0; row<sheet.Count;row++)
            {
                for (var col = 0; col < sheet[row].Count;col++ )
                {
                    worksheet.Cells[row, col] = new Cell(sheet[row][col]);
                }
            }
            workbook.Worksheets.Add(worksheet);
            workbook.Save(file);

            return file;
        }
开发者ID:surgerer,项目名称:QrTrack,代码行数:32,代码来源:FileGenerator.cs

示例11: EnteteSRFLigne2

 public Worksheet EnteteSRFLigne2(Worksheet worksheet,string NomSoc,string Date1,string Date2,string CodeSoc,bool PeNormal,bool Bonus,string DatePe)
 {
     worksheet.Cells[1, 0] = new Cell("D0");
     worksheet.Cells[1, 1] = new Cell("UTF8");
     worksheet.Cells[1, 2] = new Cell((DateTime.Now.ToString().Substring(0,10)));
     string HeureMin = ExtraireHeure(DateTime.Now.Hour.ToString(),DateTime.Now.Minute.ToString(),DateTime.Now.Second.ToString());
     worksheet.Cells[1, 3] = new Cell(HeureMin);
     worksheet.Cells[1, 4] = new Cell("SRF");
     worksheet.Cells[1, 5] = new Cell("M2.0.2.0");
     worksheet.Cells[1, 6] = new Cell("F1.0.0");
     worksheet.Cells[1, 7] = new Cell("ABC");
     worksheet.Cells[1, 8] = new Cell("TN");
     worksheet.Cells[1, 9] = new Cell(CodeSoc);
     worksheet.Cells[1, 10] = new Cell(NomSoc);
     worksheet.Cells[1, 11] = new Cell("TN");
     worksheet.Cells[1, 12] = new Cell("TND");
     worksheet.Cells[1, 13] = new Cell(DatePe);
     worksheet.Cells[1, 14] = new Cell(Date1);
     worksheet.Cells[1, 15] = new Cell(Date2);
     worksheet.Cells[1, 16] = new Cell(1);
     int leMois = int.Parse(Date1.Substring(3, 2));
     string MoisC = service.NomDuMoisEnglish(leMois);
     string Year = Date1.Substring(6,4);
     worksheet.Cells[1, 17] = new Cell("payroll "+MoisC+" "+Year);
     string TypePay = TypedePayroll(PeNormal, Bonus);
     worksheet.Cells[1, 18] = new Cell(TypePay);
     worksheet.Cells[1, 19] = new Cell(0);       
     return worksheet;
 }
开发者ID:aymenxp,项目名称:Application-ADP-Harmonized,代码行数:29,代码来源:EnteteSRF.cs

示例12: writeHeader

        private void writeHeader(string filename)
        {
            Workbook workbook;
            if (File.Exists(filename))
                workbook = Workbook.Load(filename);
            else
                workbook = new Workbook();

            Worksheet akWorksheet = null;
            foreach (Worksheet worksheet in workbook.Worksheets)
            {
                if (worksheet.Name == TableName)
                    akWorksheet = worksheet;
            }
            if (akWorksheet == null)
            {
                akWorksheet = new Worksheet(TableName);
                workbook.Worksheets.Add(akWorksheet);
            }

            int n = 0;
            foreach (DatasetConfigRow myFeld in datasetConfig.DatasetConfigRows)
            {
                akWorksheet.Cells[0, n] = new Cell(myFeld.DatabaseField);
                n++;
            }

            workbook.Save(filename);
        }
开发者ID:zvrkan5,项目名称:DotNetSiemensPLCToolBoxLibrary,代码行数:29,代码来源:ExcelStorage.cs

示例13: EnteteOPR8Ligne1

        public Worksheet EnteteOPR8Ligne1(Worksheet worksheet,string NomSoc)
        {
            worksheet.Cells[0, 0] = new Cell("Client");
            worksheet.Cells[0, 1] = new Cell(NomSoc);

            return worksheet;
        }
开发者ID:aymenxp,项目名称:Application-ADP-Harmonized,代码行数:7,代码来源:EnteteSGR.cs

示例14: EnteteOPR8Ligne2

        public Worksheet EnteteOPR8Ligne2(Worksheet worksheet)
        {
            worksheet.Cells[1, 0] = new Cell("OPR 08");
            worksheet.Cells[1, 1] = new Cell("Comparatif Payement par Virement");

            return worksheet;
        }
开发者ID:aymenxp,项目名称:Application-ADP-Harmonized,代码行数:7,代码来源:EnteteSGR.cs

示例15: CursorExcel2003

        public CursorExcel2003(byte[] data)
        {
            var wb = Workbook.Load(new MemoryStream(data));
            if (wb == null || wb.Worksheets.Count <= 0)
                throw new ReportFormatException("Data was not recognized as Excel2003");

            _worksheet = wb.Worksheets[0];
        }
开发者ID:sxkote,项目名称:ReportGrabber,代码行数:8,代码来源:CursorExcel2003.cs


注:本文中的ExcelLibrary.SpreadSheet.Worksheet类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。