//create a new workbook var workbook = new GrapeCity.Documents.Excel.Workbook(); IWorksheet worksheet = workbook.Worksheets[0]; worksheet.Range["A1"].Value = "hello"; // Add a defined name. workbook.Names.Add("Headings", "=Sheet1!$A$1"); //Set values for built-in document properties workbook.BuiltInDocumentProperties.Author = "Beryl"; workbook.BuiltInDocumentProperties.Company = "Company Name"; // Add a custom document property. IDocumentProperty property = workbook.CustomDocumentProperties.AddLinkToContent("aaa", "Headings"); var value = property.Value; // The value is "Hello". Console.WriteLine(value); var type = property.Type; // The Type is String. Console.WriteLine(type); // Save to an excel file workbook.Save("DocumentProperties.xlsx");
' Create a new Workbook Dim workbook As New Workbook Dim worksheet As IWorksheet = workbook.Worksheets(0) worksheet.Range!A1.Value = "hello" ' Add a defined name. workbook.Names.Add("Headings", "=Sheet1!$A$1") 'Set values for built-in document properties With workbook.BuiltInDocumentProperties .Author = "Beryl" .Company = "Company Name" End With ' Add a custom document property. Dim docProp As IDocumentProperty = workbook.CustomDocumentProperties.AddLinkToContent("aaa", "Headings") Dim value = docProp.Value ' The value is "Hello". Console.WriteLine(value) Dim type = docProp.Type ' The Type is String. Console.WriteLine(type) ' save to an excel file workbook.Save("DocumentProperties.xlsx")