1

I'm using OpenXML in a C# project to generate a file, read and write data in the generated Excel file.

Everything is working, except that I need to compare the "Modified" and "Created" date in the file properties to be able to know if the file have changed.

When I'm saving the file via Excel, this is what the dates looks like :

enter image description here

This is what we expect.

But when I'm saving the file via my C# and OpenXML software, this is what I have :

enter image description here

The code change both dates with the same timestamp.

I'm using this code to save my file

spreadsheetDocument.Save();
spreadsheetDocument.Close();

I also tried to :

  • Save via the WorkbookPart and not the SpreadsheetDocument, but same result :
workbookPart.Workbook.Save();
  • Remove the Save() function, but same result :
//spreadsheetDocument.Save();
spreadsheetDocument.Close();

Does anyone already encountered this ? I looked into the documentation, and I found nothing about the Save() function and the change of the timestamp.

Thanks in advance for your time !

Kaizer80
  • 23
  • 3

0 Answers0