Hello -
I’m testing version 3.5 of the Aspose.Excel component. Everything seems fine except it doesn’t look like the cells.HideColumn and cells.HideRow commands work anymore. It’s like the component just ignores them. Is this the intended behavior?
Hi wolfgang,
I did make some changes in HideRow/Column method. However, in my machine, they all work as before. If it occurs in your place, it should be a bug. Could you please post your template file and sample code here? I will check it ASAP. Thank you very much.
I included the routine in which I’m calling the hidecolumn method. It looks like the routine will correctly hide columns 0 and 1 (almost like it converts the column passed in into a bit type), but anything higher than 1 will not work. I also tried setting the column width to 0, but it has the same behavior. Any suggestions? I’ve included the routine in which I’m calling the hidecolumns routine.
Thanks,
Brian
Private Sub _FormatColumns(ByVal oSheet As Aspose.Excel.Worksheet)
Dim xCol As Integer = 0
Dim totColCount As Integer = _Parent.Forecast.Columns.Count
Dim oCells As Aspose.Excel.Cells
_waitForm.ResetProgressBar()
Windows.Forms.Application.DoEvents()
For col As Integer = 0 To _Parent.Forecast.Columns.Count - 1
If _Parent.Forecast.Columns(col).Visible Then
oSheet.AutoFitColumn(xCol)
xCol += 1
Else
oCells = oSheet.Cells
'TODO
oCells.HideColumn(0)
oCells.HideColumn(1)
oCells.HideColumn(2)
oCells.HideColumn(3)
oCells.HideColumn(4)
oCells.HideColumn(5)
End If
_waitForm.IncrementProgressBar(CType((col / totColCount) * 100, Integer) - _waitForm.ProgressBarValue)
Windows.Forms.Application.DoEvents()
Next
oSheet.FreezePanes(0, 3, _Parent.Forecast.RowCount, 3)
End Sub
Hi Brian,
I think it may have something to do with your template file. The following is my test code and all work fine. Could you try it in your machine?
Excel excel = new Excel();
excel.Open(“d:\test\book3.xls”);
for(int i = 0; i < 10; i ++)
{
excel.Worksheets[0].Cells.HideColumn((byte)i);
}
excel.Save(“d:\test\abc.xls”);
And this is my currently used version.
I am not using a template file. I create an Aspose.Excel object in memory and manipulate that object.
Hi Brian,
I used the following code to test it but don't find the problem.
Dim license As Aspose.Excel.License = New Aspose.Excel.License()
license.SetLicense("d:\\aspose.excel.ent.lic")
Dim excel As Excel = New Excel()
Dim cells As Cells = excel.Worksheets(0).Cells
Dim i As Integer
For i = 0 To 10
cells(0,i).PutValue("abcdsfsdfsdfdsfdsfdsfdsfds"+ i.ToString())
Next
Dim i As Integer
For i = 0 To 10
excel.Worksheets(0).AutoFitColumn(i)
Next
Dim i As Integer
For i = 0 To 5
cells.HideColumn(CType(i, Byte))
Next
excel.Worksheets(0).FreezePanes(0, 3, 10, 3)
excel.Save("d:\\test\\abc.xls")
Have you called AutoFit method after calling Hide method?
Could you please trim your code to make a simple case to show this problem? That will greatly help us. Thank you very much.
I found the issue. It was an issue with my code and has been fixed. Sorry to bother you.