NanoXLSX.Writer 3.0.0-rc.3
Loading...
Searching...
No Matches
MetadataAppWriter.cs
1/*
2 * NanoXLSX is a small .NET library to generate and read XLSX (Microsoft Excel 2007 or newer) files in an easy and native way
3 * Copyright Raphael Stoeckli © 2025
4 * This library is licensed under the MIT License.
5 * You find a copy of the license in project folder or on: http://opensource.org/licenses/MIT
6 */
7
9using NanoXLSX.Registry;
10using NanoXLSX.Registry.Attributes;
11using NanoXLSX.Utils.Xml;
12
14{
18 [NanoXlsxPlugIn(PlugInUUID = PlugInUUID.MetadataAppWriter)]
19 internal class MetadataAppWriter : IPlugInWriter
20 {
21 private XmlElement properties;
22
23 #region properties
27 public Workbook Workbook { get; set; }
28
32 public XmlElement XmlElement { get => properties; }
33
34 #endregion
35 #region constructors
39 internal MetadataAppWriter()
40 {
41 }
42
43 #endregion
44 #region methods
49 public void Init(IBaseWriter baseWriter)
50 {
51 this.Workbook = baseWriter.Workbook;
52 }
53
57 public void Execute()
58 {
59 properties = XmlElement.CreateElement("Properties");
60 properties.AddDefaultXmlNameSpace("http://schemas.openxmlformats.org/officeDocument/2006/extended-properties");
61 properties.AddNameSpaceAttribute("vt", "xmlns", "http://schemas.openxmlformats.org/officeDocument/2006/docPropsVTypes");
62 Metadata md = Workbook.WorkbookMetadata;
63 properties.AddChildElementWithValue("TotalTime", "0");
64 properties.AddChildElementWithValue("Application", md.Application);
65 properties.AddChildElementWithValue("DocSecurity", "0");
66 properties.AddChildElementWithValue("ScaleCrop", "false");
67 properties.AddChildElementWithValue("Manager", md.Manager);
68 properties.AddChildElementWithValue("Company", md.Company);
69 properties.AddChildElementWithValue("LinksUpToDate", "false");
70 properties.AddChildElementWithValue("SharedDoc", "false");
71 properties.AddChildElementWithValue("HyperlinkBase", md.HyperlinkBase);
72 properties.AddChildElementWithValue("HyperlinksChanged", "false");
73 properties.AddChildElementWithValue("AppVersion", md.ApplicationVersion);
74
75 WriterPlugInHandler.HandleInlineQueuePlugins(ref properties, Workbook, PlugInUUID.MetadataAppInlineWriter);
76 }
77
78 #endregion
79 }
80}