コード例 #1
0
ファイル: ExcelWorksheets.cs プロジェクト: okevin/chama
        internal ExcelWorksheets(ExcelPackage pck, XmlNamespaceManager nsm, XmlNode topNode) :
            base(nsm, topNode)
        {
            _pck = pck;
            _namespaceManager = nsm;
            _worksheets       = new Dictionary <int, ExcelWorksheet>();
            int positionID = 1;

            foreach (XmlNode sheetNode in topNode.ChildNodes)
            {
                string name = sheetNode.Attributes["name"].Value;
                //Get the relationship id
                string relId   = sheetNode.Attributes["r:id"].Value;
                int    sheetID = Convert.ToInt32(sheetNode.Attributes["sheetId"].Value);

                //Hidden property
                eWorkSheetHidden hidden = eWorkSheetHidden.Visible;
                XmlNode          attr   = sheetNode.Attributes["state"];
                if (attr != null)
                {
                    hidden = TranslateHidden(attr.Value);
                }

                PackageRelationship sheetRelation = pck.Workbook.Part.GetRelationship(relId);
                Uri uriWorksheet = PackUriHelper.ResolvePartUri(pck.Workbook.WorkbookUri, sheetRelation.TargetUri);

                //add the worksheet
                _worksheets.Add(positionID, new ExcelWorksheet(_namespaceManager, _pck, relId, uriWorksheet, name, sheetID, positionID, hidden));
                positionID++;
            }
        }
コード例 #2
0
 /// <summary>
 /// Initialize a new Chart Sheet.
 /// </summary>
 /// <param name="ns">The namespace manager.</param>
 /// <param name="pck">The package that this chartsheet is contained in.</param>
 /// <param name="relID">The relID of the new sheet.</param>
 /// <param name="uriWorksheet">The URI to save the new sheet to.</param>
 /// <param name="sheetName">The name of the new sheet.</param>
 /// <param name="sheetID">The ID of the new sheet.</param>
 /// <param name="positionID">The index of the sheet in the Worksheets collection.</param>
 /// <param name="hidden">The <see cref="eWorkSheetHidden"/> state of the worksheet.</param>
 public ExcelChartsheet(XmlNamespaceManager ns, ExcelPackage pck, string relID, Uri uriWorksheet, string sheetName, int sheetID, int positionID, eWorkSheetHidden hidden) :
     base(ns, pck, relID, uriWorksheet, sheetName, sheetID, positionID, hidden)
 {
 }
コード例 #3
0
 /// <summary>
 /// Initialize a new Chart Sheet.
 /// </summary>
 /// <param name="ns">The namespace manager.</param>
 /// <param name="pck">The package that this chartsheet is contained in.</param>
 /// <param name="relID">The relID of the new sheet.</param>
 /// <param name="uriWorksheet">The URI to save the new sheet to.</param>
 /// <param name="sheetName">The name of the new sheet.</param>
 /// <param name="sheetID">The ID of the new sheet.</param>
 /// <param name="positionID">The index of the sheet in the Worksheets collection.</param>
 /// <param name="hidden">The <see cref="eWorkSheetHidden"/> state of the worksheet.</param>
 /// <param name="chartType">The <see cref="eChartType"/> of the new chart.</param>
 public ExcelChartsheet(XmlNamespaceManager ns, ExcelPackage pck, string relID, Uri uriWorksheet, string sheetName, int sheetID, int positionID, eWorkSheetHidden hidden, eChartType chartType) :
     base(ns, pck, relID, uriWorksheet, sheetName, sheetID, positionID, hidden)
 {
     this.Drawings.AddChart("Chart 1", chartType);
 }