Skip to content
This repository has been archived by the owner on Mar 9, 2020. It is now read-only.

4.5.3.2 fails to read long data type custom properties #592

Open
Texbase opened this issue Dec 10, 2019 · 0 comments
Open

4.5.3.2 fails to read long data type custom properties #592

Texbase opened this issue Dec 10, 2019 · 0 comments

Comments

@Texbase
Copy link

Texbase commented Dec 10, 2019

We migrated from 4.1.1.0 to 4.5.3.2 and can no longer read custom properties that are Int64/long data types.

On creation of the Excel file:
package.Workbook.Properties.SetCustomPropertyValue("Timestamp", DateTime.Now.Ticks);

On reading of the Excel file (with changes to the Excel file):
DateTime timestamp = new DateTime(Convert.ToInt64(package.Workbook.Properties.GetCustomPropertyValue("Timestamp")));

Always results in null, even though the CustomPropertiesXml contains a valid value:

<property name="Timestamp" pid="10" fmtid="{D5CDD505-2E9C-101B-9397-08002B2CF9AE}">
 <vt:r8>6.37115722044558E+17</vt:r8>
</property>

DotNetFiddle:

using System;
public class Program
{
	public static void Main()
	{
		Console.WriteLine(new DateTime(Convert.ToInt64(6.37115722044558E+17)));
		// returns 12/10/2019 10:56:44 AM		
	}
}

If we create the Excel file and immediately try to read it (without making any changes to it), the custom property is read successfully.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant