Hello,
We have encountered another very interesting problem that appears in our system while using aspose cells. After we insert the watermark in the exact same way as explained above, meaning that we add a picture into the header, we have to insert it into a rights management system that protects the excel file. If we insert watermark with aspose cells, after protecting the document we get all the charts in document broken, meaning that the graphs are not linked to the data any longer.
If we do the same thing that we do with aspose cells manually, everything works fine.
This happens with both xls and xlsx files (while in xls it brakes the graph and shows all the values on zero, the chart disappears completely in the xlsx files).
My guess is that aspose cells does something different than adding it manually from the excel office client, something that may further break the structure in irm systems.
I have attached 4 files
- 2 (same thing but in 2 formats, xls and xlsx) with the image added into the header manually
- 2 (same thing but in 2 formats, xls and xlsx) with the image added in the header with aspose cells
So practically aspose does something different in the file than doing it manually in office and that may affect future file processing.
Maybe you can take a look in the file structure and see what differs from the manually insterted watermark version.
The code used for this is very simple:
public static void InsertImageXLS_X(string path, byte[] img)
{
Aspose.Cells.FileFormatInfo info = Aspose.Cells.FileFormatUtil.DetectFileFormat(path);
if (info.LoadFormat == Aspose.Cells.LoadFormat.Xlsx || info.LoadFormat == Aspose.Cells.LoadFormat.Excel97To2003)
{
Workbook workbook = new Workbook(path);
//Creating a PageSetup object to get the page settings of the first worksheet of the workbook
foreach (Worksheet sheet in workbook.Worksheets)
{
sheet.ViewType = ViewType.PageLayoutView;
Aspose.Cells.PageSetup pageSetup = sheet.PageSetup;
pageSetup.SetHeader(1, “\n \n \n \n \n \n \n &“Times New Roman”&C&G”);
pageSetup.SetHeaderPicture(1, img);
}
workbook.Save(path);
}
}
Thank you,
Dan