Conditional Cells Format Lost

Hi.

We have an Excel document with various worksheets. In the last worksheet we have a conditional format in all cells. When we have been using Aspose.Cells to complete the excel document the cells lose the conditional format. See attached files.

Can you help us?

Thanks you.

Hi,

Recently we have fixed an issue related to Conditional Formatting. Please try using the attached hotfix and in case the issue is not resolved, share the code that you are using. Thanks for contacting support and if you have any further questions please contact us.

Hi, again.

Sorry, but we have the same problem after the hotfix.

The cells lose the conditional rules after we use Aspose.Cells to complete the worksheet.

This is the code:

LicenciarCells();

Workbook workbook = new Workbook();

workbook.Open(BalanceTemplatePath);

if (balanceData != null)

{

Cells cells = workbook.Worksheets[0].Cells;

foreach (KeyValuePair<string, string> bal in BalanceMapper)

{

object prop = balanceData.GetType().GetProperty(bal.Value);

object value = string.Empty;

if (prop == null)

value = string.Format("El campo {0} de la entidad no ha sido encontrado en la entidad", bal.Value);

else

value = balanceData.GetType().GetProperty(bal.Value).GetValue(balanceData, null) ?? string.Empty;

cells[bal.Key].PutValue(value);

}

}

if (pygData != null)

{

Cells cells = workbook.Worksheets[1].Cells;

foreach (KeyValuePair<string, string> pyg in PyGMapper)

{

object prop = pygData.GetType().GetProperty(pyg.Value);

object value = string.Empty;

if (prop == null)

value = string.Format("El campo {0} de la entidad no ha sido encontrado en la entidad", pyg.Value);

else

value = pygData.GetType().GetProperty(pyg.Value).GetValue(pygData, null) ?? string.Empty;

cells[pyg.Key].PutValue(value);

}

}

_generatedFile = string.Format("~/Temp/Balance-PyG_{0}.xls", DateTime.Now.Ticks);

workbook.Save(GeneratedFile);

Thanks for all.

Regards.

Hi,

We have found that its an issue of conditional formatting. It’s an advanced feature of MS Excel 2007. For the time being, please save it as xlsx file in MS Excel 2007 format as Aspose.Cells
has supported this feature of xlsx file. We will try our level best to support this feature in Excel 97-2003 xls files, very soon.

We are sorry for this problem.

Hi again.

It works properly, but when we open the EXCEL document with Microsoft Office 2007 gives an error. In error, EXCEL 2007 says that if we want recovery the EXCEL file.

See attached.

Thank you.

Hi,



We have fixed the issue regarding opening error in MS Excel. Please try
the latest version of Aspose.Cells for .NET v5.1.0. You can download it from http://www.aspose.com/community/files/51/.net-components/aspose.cells-for-.net/entry248967.aspx



However, we have analyzed your .xlsx file and have found that some extra data was added to it. The extra data is some script string. We think it was the
response object that added the text into the file stream. Please call
“Response.end()” after calling Workbook.Save(Response,…);

Hi, again.

We have the same problem with the new version. We don't use a file stream. We have a EXCEL template and we use it to change the cells values to form the EXCEL result. The code we have used it's in the thrid post.

See attached.

Thanks.

Hi,



Please open the file that you shared earlier with UltraEdit or any other text editor and you
will be able to notice the extra string data in the end of the file. This data causes
the excel warning.



Currently I am not aware with the fact that how this data was added ? maybe you can check the code
for saving the file. If you still find the problem, please share with us a
simple project with the input/output files to reproduce the issue.

Hi, again.

Thank you very much for your help. We have saw the issue and it works properly after we have corrected it.

Thanks for all.

Best regards.