When my Office Writer Excel report opens, it randomly un-hides some of the hidden cells and columns. I have verified that it is not the data that causes the columns or cells to not be hidden. Has anyone experienced this before and is there a way to make sure that all columns or cells stay hidden when the excel file is opened?
Asked
Active
Viewed 234 times
0
-
Would it be possible to post some of the code that you are using to generate your file? Are you hiding cells and columns in code? Also, are you using any sort of filtering mechanism (auto-filter, table) in your spreadsheet? – AlisonB Oct 28 '13 at 19:53
-
I am hidding the cells in code. No filtering - just hidding certain columns or cells that have data that is used to calculate some of the column totals. The hidden values issue is random, some users never see the hidden columns or cells and some randomly see the hidden columns or cells. – user2929422 Oct 28 '13 at 19:58
-
Would it be possible to post the code that you are using to hide the columns or rows? When the users sometimes see the hidden content, but sometimes don't, is that with the same file or with different files? – AlisonB Oct 30 '13 at 14:53
1 Answers
0
I work for SoftArtisans. We have not had any other reports of programmatically hidden columns becoming visible in the output file. We also have not been able to reproduce the behavior you are reporting. It would be helpful to see a code snippet, as well as to know which version of OfficeWriter you are using and which version of Excel is being used to open the output file.
There are two ways to hide columns with our API, both using the ColumnProperties object. You can set the hidden property to true or set the width property to zero. You could do both if you like, although that shouldn't be necessary.
For example:
ExcelApplication xla = new ExcelApplication();
Workbook wb = xla.Create(ExcelApplication.FileFormat.Xlsx);
//or if opening an existing workbook
//Workbook wb = xla.Open(inputFilePath);
//Get a handle on the worksheet
Worksheet ws = wb.Worksheets[0];
//Write a value to a cell
ws.Cells[0, 9].Value = "Hidden Value";
//Get a handle on the column you want to hide
ColumnProperties colProps = ws.GetColumnProperties(9);
//set the column to hidden
colProps.Hidden = true;
//or set the column width to zero
colProps.Width = 0;
//Stream the output file to the response
xla.Save(wb, Page.Response, "HiddenColumnTest.xlsx", false);

Aviva M.
- 381
- 1
- 9