I am using Aspose cells version 7.0.4.0 and the Runtime version is v2.0.50727, I am writing the c# code to hide the rows of excel. I have already tried below line of codes to hide the row, but none of them is affecting:
Thank you for the reply.
I tried your suggested code but still it is not affecting in the excel file.
Please see the whole code below, am I missing something ? Kindly let me know what is wrong in my code.
I tried all the possible ways to achieve my task but nothing works.
Please help me out.
public void EmptyReportTemplate(Dictionary<string, object> dictDatasource, string strReportName, CELLS.Workbook oReportWorkbook, bool blnAddToSubmissionYear = true)
{
CELLS.Workbook oTempWorkbook = null;
int iSubmissionYear = -1;
iSubmissionYear = _SubmissionYear;
if (blnAddToSubmissionYear)
{
for (int i = 0; i < 24; i++) { dictDatasource.Add(("NextYear" + (i + 1).ToString()), (iSubmissionYear + (i + 1)).ToString()); }
}
else
{
for (int i = 0; i < 24; i++) { dictDatasource.Add(("NextYear" + (i + 1).ToString()), (iSubmissionYear + i).ToString()); }
}
oTempWorkbook = new CELLS.Workbook(_Path + TEMPLATE_FOLDER + strReportName);
foreach (CELLS.Worksheet ws in oTempWorkbook.Worksheets)
{
#Hide Row Code
//--not working
int rowIndex = CellsHelper.RowNameToIndex("24");
ws.Cells.HideRow(rowIndex);
AutoFitterOptions opt = new AutoFitterOptions();
opt.IgnoreHidden = true;
ws.AutoFitRows(opt);
//-- successfully working, 'D' column is hidden in excel
Column column = ws.Cells.Columns[3];
column.IsHidden = true;
//ws.Protect(ProtectionType.All, "TEST", "");
#endregion
oReportWorkbook.Worksheets.Add(ws.Name);
oReportWorkbook.Worksheets[ws.Name].Copy(ws);
}
ProcessWorkBook(dictDatasource, oReportWorkbook, false);
}
Please first try the code segment shared by Shakeel Faiz in his previous reply if it works fine or not? If it does not work fine with your older version, then I guess, as you are using older version of the product (e.g v7.0.4.x), so it might be an issue with the product you are using. We are very sorry but we cannot evaluate your issue in older version, nor we can fix any issue (if found) in older versions. The fixes are only based on latest APIs set. We recommend kindly upgrade to and use latest version of the product (i.e., Aspose.Cells for .NET v18.1.x), it should work fine.
If you still find the issue with latest version/fix v18.1.x for your scenario/case, kindly do create a simple standalone console application (runnable), zip the project and post us here (excluding Aspose.Cells assembly) to reproduce the issue on our end, we will check and help you soon. Please make sure that your project should be executable so you should make it simple and remove any inter-dependencies, external references, or other objects, etc., so we could run it to reproduce the issue on our end.
Cookie Notice
To provide you with the best experience, we use cookies for personalization, analytics, and ads. By using our site, you agree to our cookie policy.
Enables storage, such as cookies, related to analytics.
Sets consent for sending user data to Google for online advertising purposes.
Sets consent for personalized advertising.
Cookie Notice
To provide you with the best experience, we use cookies for personalization, analytics, and ads. By using our site, you agree to our cookie policy.
More info
Enables storage, such as cookies, related to analytics.
Enables storage, such as cookies, related to advertising.
Sets consent for sending user data to Google for online advertising purposes.
Sets consent for personalized advertising.
Cookie Notice
To provide you with the best experience, we use cookies for personalization, analytics, and ads. By using our site, you agree to our cookie policy.
More info
Enables storage, such as cookies, related to analytics.
Enables storage, such as cookies, related to advertising.
Sets consent for sending user data to Google for online advertising purposes.