简体   繁体   English

使用 ClosedXML 库隐藏工作表不起作用

[英]Hide sheet not working using ClosedXML library

XLWorkbook wb = null;    
            IXLWorksheet ws = null;    
            String currentDateTimeDirPath = Directory.GetCurrentDirectory() + @"\" + DateTime.Now.ToString("dd-MMM-yyyy");    
            if (!Directory.Exists(currentDateTimeDirPath))    
            {    
                Directory.CreateDirectory(currentDateTimeDirPath);    
            }    
            string strFileName = DateTime.Now.ToString("dd.MM.yy.HHmmsss") + ".xlsx";    
            string strFilePath = currentDateTimeDirPath + @"\" + strFileName;    
            wb = new XLWorkbook();    
            wb.Worksheets.Add("Sheet1");    
            ws = wb.Worksheets.First();    
            ws.Cell(1, 1).Value = "Hello there 1111111";    
            ws.Hide(); //Not hiding worksheet     
            ws.CollapseRows(); //Not Collapsing rows    
            ws.CollapseColumns(); //Not collapsing columns     
            ws.Protect("12345678");     
            wb.SaveAs(strFilePath);     

I don't find the method Hide() .我没有找到Hide()方法。 But you can use the property Visible as described here但是您可以按照此处所述使用Visible属性

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM