Unreadable content

Mar 21, 2012 at 6:27 PM

First off, this is an awesome tool!

I'm using C# with EPPlus to create an excel file (.xlsx).  This file then gets emailed to business users.  On Windows 7 with Office 2010, I can open the file with no problem.  The business users are using Office 2007, and they get the following message when trying to open it.

Excel found unreadable content in 'filename.xlsx'. Do you want to recover the contents of this workbook? If you trust the source of this workbook, click Yes.

Has anyone dealt with this, or have a solution?

Thanks!

Mar 21, 2012 at 6:28 PM

Forgot to add:

If the user pushes no, and selects no to any further prompts, it will open.  This is an annoyance we would like to get rid of.

Thanks!

Apr 15, 2012 at 10:41 PM

I'm having similar problems with an .xlsm file. I'm able to successfully open a copy of the file, we don't want to touch the original, get a reference to one of the worksheets and insert rows. However, after the file is saved, when I try to open it with Excel 2010, I'm getting the "Excel found unreadable content..." error dialog. Here's a code snippet of that process:

Anyone?

          using (ExcelPackage xlPkg = new ExcelPackage(new FileInfo(workingFileName)))
          {
            ExcelWorksheet xlWs = xlPkg.Workbook.Worksheets["Equipment Inventory"];

            foreach (ImportEquipmentInventoryToDataset.EquipmentInventory.EquipmentInventoryRow row in dt)
            {
              string equipNumber = Convert.ToString(row.EquipmentUnitNumber);
              string equipOperator = Convert.ToString(row.Operator);
              string equipMake = Convert.ToString(row.Make);
              string equipModel = Convert.ToString(row.Model);
              string equipHorsePower = Convert.ToString(row.HorsePower);
              string equipCapacity = Convert.ToString(row.Capacity);
              string equipFEMACostCode = Convert.ToString(row.FEMACostCode);
              double equipAdjustedCostCodeUnitPrice = Convert.ToDouble(row.AdjustedCostCodeUnitPrice);
              string equipComments = Convert.ToString(row.Comments);

              xlWs.Cells[currentRow, 3].Value = equipNumber;
              xlWs.Cells[currentRow, 4].Value = equipOperator;
              xlWs.Cells[currentRow, 5].Value = equipMake;
              xlWs.Cells[currentRow, 6].Value = equipModel;
              xlWs.Cells[currentRow, 7].Value = equipHorsePower;
              xlWs.Cells[currentRow, 8].Value = equipCapacity;
              xlWs.Cells[currentRow, 9].Value = equipFEMACostCode;
              xlWs.Cells[currentRow, 10].Value = equipAdjustedCostCodeUnitPrice;
              xlWs.Cells[currentRow, 11].Value = equipComments;

              currentRow++;

              //break;
            }
            xlPkg.Save();

 

Apr 16, 2012 at 5:51 PM
as said EPPlus does not support excel 2010 formats; opt for NPOI

On 16/04/2012, pkspence <notifications@codeplex.com> wrote:
> From: pkspence
>
> I'm having similar problems with an .xlsm file. I'm able to successfully
> open a copy of the file, we don't want to touch the original, get a
> reference to one of the worksheets and insert rows. However, after the file
> is saved, when I try to open it with Excel 2010, I'm getting the "Excel
> found unreadable content..." error dialog. Here's a code snippet of that
> process: Anyone? using (ExcelPackage xlPkg = new ExcelPackage(new
> FileInfo(workingFileName))) { ExcelWorksheet xlWs =
> xlPkg.Workbook.Worksheets["Equipment Inventory"]; foreach
> (ImportEquipmentInventoryToDataset.EquipmentInventory.EquipmentInventoryRow
> row in dt) { string equipNumber =
> Convert.ToString(row.EquipmentUnitNumber); string
> equipOperator = Convert.ToString(row.Operator); string
> equipMake = Convert.ToString(row.Make); string equipModel =
> Convert.ToString(row.Model); string equipHorsePower =
> Convert.ToString(row.HorsePower); string equipCapacity =
> Convert.ToString(row.Capacity); string equipFEMACostCode =
> Convert.ToString(row.FEMACostCode); double
> equipAdjustedCostCodeUnitPrice =
> Convert.ToDouble(row.AdjustedCostCodeUnitPrice); string
> equipComments = Convert.ToString(row.Comments);
> xlWs.Cells[currentRow, 3].Value = equipNumber;
> xlWs.Cells[currentRow, 4].Value = equipOperator;
> xlWs.Cells[currentRow, 5].Value = equipMake;
> xlWs.Cells[currentRow, 6].Value = equipModel;
> xlWs.Cells[currentRow, 7].Value = equipHorsePower;
> xlWs.Cells[currentRow, 8].Value = equipCapacity;
> xlWs.Cells[currentRow, 9].Value = equipFEMACostCode;
> xlWs.Cells[currentRow, 10].Value = equipAdjustedCostCodeUnitPrice;
> xlWs.Cells[currentRow, 11].Value = equipComments;
> currentRow++; //break; }
> xlPkg.Save();
>
>


--
Greetings,
Bhavtosh Sharma
Editor
Apr 16, 2012 at 6:01 PM

EPPlus handles OOXML standard, so it will support Excel 2007 and 2010. I cant imagine why works fine local but not works after send by mail.

How do you send by mail? Did you send using your own code? Did you try to send using another client or web client ?

 

 

Apr 16, 2012 at 11:04 PM
Edited Apr 16, 2012 at 11:06 PM
bhavtoshsharma wrote:
as said EPPlus does not support excel 2010 formats; opt for NPOI

--
Greetings,
Bhavtosh Sharma

 I'd understood that EEPlus does support Office 2007/2010 format. I've used NPOI extensively in both web and desktop applications and it's great, but it does not support the OOXML standard, at least not yet.