"Converted failed to open the file" error

B

BackInNova

Hello,

I have a .net code that uses ExcelPackage to generate server-side
Excel 2007 spreadsheets. Basically, ExcelPackage is a wrapper aorund
the Open XML format.

http://excelpackage.codeplex.com/

My code is as follows

Imports OfficeOpenXml

Dim newfilePath As String = "C:\Upload\Test.xlsx"

Using xlpackage As ExcelPackage = New ExcelPackage(newFile)

xlpackage.Workbook.Styles.Fonts(0).Bold = True

xlpackage.Workbook.Styles.Fonts(0).FontName = "Arial"

xlpackage.Workbook.Styles.Fonts(0).Size = Convert.ToString(9)

xlpackage.Workbook.Styles.Fonts(0).Color = "FF0000"

' Add new sheet name

oSheet = xlpackage.Workbook.Worksheets.Add("Test_Sheet1")

oSheet.Cell(1, 1).Value = "Amount"

oSheet.Cell(2, 1).Value = "10"

oSheet.Cell(3, 1).Value = "20"

oSheet.Cell(4, 1).Formula = "=SUM('A2':'A3')"

' save our new workbook and we are done!

xlpackage.Save()

End Using

This code creates Test.xlsx but when I try to open it with Excel 2003,
I get "The converted failed to open the file" error.

I downloaded Excel viewer and saw the same problem there.

When I comment out the lines where I am changing the font and then
create the report, I am able to open it just fine.

How can I use the formatting functionality without any problems?

Thank you,

Six
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top