Пример #1
0
 /// <summary>
 /// Class constructor
 /// </summary>
 /// <param name="document">Document to perform operations on</param>
 /// <param name="fullName">Full path name of document</param>
 public SpreadsheetDocument(OpenXmlSDK.SpreadsheetDocument document, string fullName)
     : base()
 {
     Document         = document;
     FullName         = fullName;
     InnerContent     = new SpreadsheetDocumentManager(this);
     Worksheets       = new WorksheetAccessor(this);
     Chartsheets      = new ChartsheetAccessor(this);
     CustomProperties = new CustomPropertiesAccesor(this);
     Tables           = new SpreadSheetTableAccesor(this);
     Style            = new SpreadSheetStyleAccessor(this);
 }
Пример #2
0
        /// <summary>
        /// Creates a new SpreadsheetDocument from a new or existing file
        /// </summary>
        /// <param name="filePath">Path of file</param>
        /// <param name="createNew">Whether create a new document or load from an existing one</param>
        public SpreadsheetDocument(string filePath, bool createNew)
        {
            try
            {
                if (createNew)
                {
                    Document = OpenXmlSDK.SpreadsheetDocument.Create(filePath, DocumentFormat.OpenXml.SpreadsheetDocumentType.Workbook);
                }
                else
                {
                    Document = OpenXmlSDK.SpreadsheetDocument.Open(filePath, true);
                }
            }
            catch (Exception e)
            {
                System.Diagnostics.Debug.Write(e.Message);
            }

            FullName         = filePath;
            InnerContent     = new SpreadsheetDocumentManager(this);
            Worksheets       = new WorksheetAccessor(this);
            Chartsheets      = new ChartsheetAccessor(this);
            CustomProperties = new CustomPropertiesAccesor(this);
        }
Пример #3
0
 /// <summary>
 /// Creates a SpreadsheetDocument from a data table
 /// </summary>
 /// <param name="outputPath">Path of generated file</param>
 /// <param name="headerList">Header row contents</param>
 /// <param name="valueTable">Data values</param>
 /// <param name="initialRow">Row index to start copying data</param>
 /// <returns>Spreadsheet document</returns>
 public static SpreadsheetDocument Create(string outputPath, List <string> headerList, string[][] valueTable, int initialRow)
 {
     return(SpreadsheetDocumentManager.Create(outputPath, headerList, valueTable, initialRow));
 }
Пример #4
0
 /// <summary>
 /// Creates a SpreadsheetDocument with a chart from a data table
 /// </summary>
 /// <param name="outputPath">Path of generated file</param>
 /// <param name="headerList">Header row contents</param>
 /// <param name="valueTable">Data values</param>
 /// <param name="chartType">Chart type</param>
 /// <param name="headerColumn">Column to use as category for charting</param>
 /// <param name="columnsToChart">Columns to include in chart</param>
 /// <param name="initialRow">Row index to start copying data</param>
 /// <returns>Spreadsheet document</returns>
 public static SpreadsheetDocument Create(string outputPath, List <string> headerList, string[][] valueTable, ChartType chartType, string headerColumn, List <string> columnsToChart, int initialRow)
 {
     return(SpreadsheetDocumentManager.Create(outputPath, headerList, valueTable, chartType, headerColumn, columnsToChart, initialRow));
 }