Hi.
We have an Excel with eight workbooks, the two firts are hidden and we use aspose.cells to complete data in the hidden workbooks. The rest workbooks only present the data obtained from the hidden workbooks, than from Excel works properly, but we have used aspose to complete the hidden workbooks data the rest workbooks cells lose the format.
See the atached files.
Can you help us?.
Thank you for all.
This is the used code:
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);