把对应的隐藏列显示出来,获取值,根据需要在隐藏对应的列:
//隐藏列
sheet.Range[string.Format("{0}1:{1}1", “A”,"AZ")].EntireColumn.Hidden = false;
var range=sheet.Range[string.Format("{0}1","A")];
var text=range.Text.Trim();
把对应的隐藏列显示出来,获取值,根据需要在隐藏对应的列:sheet.Range[string.Format("{0}1:{1}1", “A”,"AZ")].EntireColumn.Hidden = false;var range=sheet.Range[string.Format("{0}1","A")];var text=range.Text.Trim();
/// </summary>
/// <param name="range">传如[A1:G1]的Range</param>
static public void SetRangeHiddenAndGroup(Range range)
range.Columns.Hidden = true;
sheet.UsedRange.EntireColumn.Hidden = false;
sheet.UsedRange.EntireRow.Hidden = false;
//是否
数据
筛选判断
if (sheet.AutoFilter != null && sheet.AutoFilterMode == true)
System.InvalidCastException:“无法将类型为“Microsoft.Office.Interop.Excel.ApplicationClass”的 COM 对象强制转换为接口类