Note
Access to this page requires authorization. You can try signing in or changing directories.
Access to this page requires authorization. You can try changing directories.
Question
Tuesday, April 23, 2013 11:53 AM
from where i get dsofile supports 64 bit?
i am struggling to add new custom properties in Excel from my vb.net app. me have 64 bit machine and Office 2013 installed. i believe this issues is because of my dsofile will not work in 64 bit machine.
me already have code which work for 32 bit machine + Office 2007
All replies (1)
Wednesday, April 24, 2013 9:00 AM âś…Answered
Hi Rosh,
Here is a blog article regarding using Dsofile on 64 bit OS:
For Office 2010 and Office 2007, there are hotfix available to fix the problem. And so far I haven't found the hotfix for Office 2013.
As it mentioned int he blog article:
If you wish to use DSOFile from a 64 bit program, then you should recompile the DSOFile to target for 64 bit.
An alternative approach to using Dsofile would be to use Open Xml SDK (or System.IO.Packaging). A sample that demonstrates this is given below:
// *****************************************************************************
// This sample is provided "AS IS" with no warranty or support from Microsoft.
// It is a demonstration, provided for informational purposes only, and has not been rigorously tested with all environments and does not contain error handling.
// It is up to you to make it "production ready" if you use it in any development solution.
// *****************************************************************************
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using DocumentFormat.OpenXml;
using DocumentFormat.OpenXml.Packaging;
using System.Xml.Linq;
namespace DocPropertiesOOX
{
class Program
{
static void Main(string[] args)
{
string filePath = @"C:\Users\test\Desktop\testzip.xlsx";
try
{
using (SpreadsheetDocument package = SpreadsheetDocument.Open(filePath,false))
{
CoreFilePropertiesPart coreFileProperties = package.CoreFilePropertiesPart;
System.IO.Stream stream = coreFileProperties.GetStream();
XDocument xdoc = XDocument.Load(coreFileProperties.GetStream());
// Display default properties
IEnumerable<XElement> awElements = from el in xdoc.Descendants()
where el.Name.Namespace == "http://schemas.openxmlformats.org/package/2006/metadata/core-properties"
select el;
foreach (XElement el in awElements)
Console.WriteLine(el.Name.LocalName + " = " + el.Value.ToString());
Console.ReadLine();
}
}
catch (Exception ex)
{
System.Windows.Forms.MessageBox.Show(ex.Message);
}
}
}
}
Max Meng
TechNet Community Support