當前位置: 首頁>>代碼示例>>C#>>正文


C# XSSFWorkbook.SetSheetHidden方法代碼示例

本文整理匯總了C#中NPOI.XSSF.UserModel.XSSFWorkbook.SetSheetHidden方法的典型用法代碼示例。如果您正苦於以下問題:C# XSSFWorkbook.SetSheetHidden方法的具體用法?C# XSSFWorkbook.SetSheetHidden怎麽用?C# XSSFWorkbook.SetSheetHidden使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在NPOI.XSSF.UserModel.XSSFWorkbook的用法示例。


在下文中一共展示了XSSFWorkbook.SetSheetHidden方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的C#代碼示例。

示例1: GenerateTemplate


//.........這裏部分代碼省略.........
                cell.CellStyle = style;
                //cell.CellStyle.IsLocked = true;

                //column width
                sheet.SetColumnWidth(col, (30 * 256));
                ++col;
            }

            //sheet.CreateFreezePane(0, 4);

            //dropdownlist Company
            if(listCompanyString.Count > 0)
            {

                XSSFSheet hidden = (XSSFSheet)workbook.CreateSheet("MasterCompany");
                int i=0;
                foreach(string a in listCompanyString)
                {
                    row = (XSSFRow)hidden.CreateRow(i);
                    cell = (XSSFCell)row.CreateCell(0);
                    cell.SetCellValue(a);
                    i++;
                }

                validation = null;
                dvConstraint = null;
                dvHelper = null;
                dvHelper=new XSSFDataValidationHelper(sheet);
                addressList = new  CellRangeAddressList(startRowIndex,parseRecordNumber,CompanyStringLocation,CompanyStringLocation);
                 dvConstraint = (XSSFDataValidationConstraint)dvHelper.CreateFormulaListConstraint("MasterCompany!$A$1:$A$" + listCompanyString.Count);
                validation = (XSSFDataValidation)dvHelper.CreateValidation(dvConstraint, addressList);
                validation.SuppressDropDownArrow = true;
                validation.ShowErrorBox = true;
                workbook.SetSheetHidden(1, true);
                sheet.AddValidationData(validation);
            }

            //dropdownlist Contractor
            if(listContractorString.Count > 0)
            {

                XSSFSheet hidden = (XSSFSheet)workbook.CreateSheet("MasterContractor");
                int i=0;
                foreach(string a in listContractorString)
                {
                    row = (XSSFRow)hidden.CreateRow(i);
                    cell = (XSSFCell)row.CreateCell(0);
                    cell.SetCellValue(a);
                    i++;
                }

                validation = null;
                dvConstraint = null;
                dvHelper = null;
                dvHelper=new XSSFDataValidationHelper(sheet);
                addressList = new  CellRangeAddressList(startRowIndex,parseRecordNumber,ContractorStringLocation,ContractorStringLocation);
                 dvConstraint = (XSSFDataValidationConstraint)dvHelper.CreateFormulaListConstraint("MasterContractor!$A$1:$A$" + listContractorString.Count);
                validation = (XSSFDataValidation)dvHelper.CreateValidation(dvConstraint, addressList);
                validation.SuppressDropDownArrow = true;
                validation.ShowErrorBox = true;
                workbook.SetSheetHidden(2, true);
                sheet.AddValidationData(validation);
            }

            //dropdownlist Project
            if(listProjectString.Count > 0)
開發者ID:,項目名稱:,代碼行數:67,代碼來源:


注:本文中的NPOI.XSSF.UserModel.XSSFWorkbook.SetSheetHidden方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。