It appears that after the users save the excel file produced by Aspose.Cell they are unable to format any cells. The worksheet is not protected, so I don't know why they would not be able to perform any formatting. Any thoughts on what might be causing this?
Below is the code used to generate this file.
objExcel = New Aspose.Excel.Excel
objSheet = objExcel.Worksheets(0)
objCells = objExcel.Worksheets(0).Cells
fileName = String.Concat(selectedSchedule, "_", currPeriod, "_", legalEntity, ".xls")
filePath = Session.Item("ExportServer")
filePath = String.Concat(filePath, fileName)
Try
schedRules = GetSchedRules(selectedSchedule, Session.Item("Connection"))
maxCols = UBound(schedRules)
cn = New SqlConnection(Session.Item("Connection"))
cn.Open()
cmdSelect = New SqlCommand("sp_select_schedule_d_export", cn)
cmdSelect.CommandType = CommandType.StoredProcedure
cmdSelect.CommandTimeout = 1800
cmdSelect.Parameters.Add("@period", currPeriod)
cmdSelect.Parameters.Add("@schedule", selectedSchedule)
cmdSelect.Parameters.Add("@legal_entity", legalEntity)
dtrSelect = cmdSelect.ExecuteReader()
cmdSelect.Dispose()
If dtrSelect.HasRows Then
While dtrSelect.Read
Dim x As Integer
objCells.Item(counter, 0).PutValue(dtrSelect.Item("line_number"))
objCells.Item(counter, 1).PutValue(dtrSelect.Item("cusip"))
objCells.Item(counter, 2).PutValue(dtrSelect.Item("description"))
If dtrSelect.Item("sched_rec_type") = "S" Then
For x = 3 To maxCols
objCells.Item(counter, x).PutValue(dtrSelect.Item("column_" & x))
Next
If selectedSchedule <> "D2S1" And selectedSchedule <> "D2S2" Then
objCells.Item(counter, x + 1).PutValue(dtrSelect.Item("state"))
End If
End If
counter += 1
End While
Else
msg = "No data for this selection!"
Exit Try
End If
dtrSelect.Close()
For z As Integer = z To maxCols + 3
objSheet.AutoFitColumn(z, 0, counter)
Next
objExcel.Save(fileName, SaveType.OpenInBrowser, FileFormatType.Default, Page.Response)