Exemple #1
0
        /// <summary>
        /// 新创建一个Excel,里面包含一个工作簿sheet1
        /// </summary>
        /// <returns></returns>
        public static WorkBook CreateNew()
        {
            WorkBook     result = new WorkBook();
            WorkBookView wbView = new WorkBookView(result);
            WorkSheet    ws     = new WorkSheet(result, DefaultSheetName);

            result.Views.Add(wbView);
            result.Sheets.Add(ws);

            return(result);
        }
        /// <summary>
        /// FileName:workbook.xml 
        /// <para>NodePath:workbook/bookViews</para>
        /// </summary>
        /// <param name="bookViewsRoot"></param>
        internal void ReadWorkBook_bookViews(XElement bookViewsRoot)
        {
            foreach (XElement item in bookViewsRoot.Nodes())
            {
                WorkBookView view = new WorkBookView(this.WorkBook);

                foreach (XAttribute attr in item.Attributes())
                {
                    view.SetAttribute(attr.Name.LocalName, attr.Value);
                }
                this.WorkBook.Views.Add(view);
            }
        }