Free Support Forum - aspose.com

Save method looses formatting

I have tried to format cells for styles, but when i opened the file in Excel, the formatting had disappeared.

When I use the save method

Overloads Public Sub Save( _
ByVal resultSpreadsheet As String, _
ByVal fileFormatType As FileFormatType, _
ByRef stream As MemoryStream _
)

to save my file, the formatting I have applied to cells, e.g., font, size, bold, etc. gets lost. I have examined the contents of the cell.style and saw them change before and after the save occurs. Is this a bug? I am using version 1.9.7.5


My code is
Private Function ConvertToBinaryReportResult() As BinaryReportResult
Dim outStream As System.IO.MemoryStream
Dim ResultBuffer() As Byte
mExcel.Save(mContext.ReportTypeName & “.xls”, FileFormatType.Excel2000, outStream)
ReDim ResultBuffer(CInt(outStream.Length - 1))
ResultBuffer = outStream.ToArray()
Dim Result As BinaryReportResult = New BinaryReportResult(“application/xls”, ResultBuffer)
Return Result
End Function




Is there support for a dispose/finalize method?


thanks.

We didn’t find the problem in our place.

Could you zip your project and send it to me? Thus we can investigate this problem more quickly.

Thanks.

Please download hotfix 1.9.8 and have a try. We fixed a bug related to formatting.

Thanks for the reply. i tested the hot fix. This did not solve my problem. What I see is that if I change the style directly as in Cell.Style.Font.IsBold = true and save, the format comes thru correctly and is displayed when i open the fiel in Excel, but if I define a style and assign it, as in Cell.Style = myStyle then save it, the formatting is lost/reset during the save. I will try to forward sample code to demonstrate.

Hi,

I got your code and will investigate it right now.