Reports in MS Access Object Library 11.0

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

Hello, I am writing an application (C#). I need to get a report (created
earlier by a user), possibly unbound, and save it to XML format. Please, tell
me how can I do it, using MS Access Object Library.
 
This is not something I've ever done in a 'real-world' app, so no promises,
but based on very limited testing, this seems to work ...

using System;
namespace ConsoleApplication22
{
class Class1
{
[STAThread]
static void Main(string[] args)
{
Microsoft.Office.Interop.Access.Application app =
new Microsoft.Office.Interop.Access.Application();
app.AutomationSecurity = Microsoft.Office.Core.MsoAutomationSecurity.
msoAutomationSecurityLow;
app.OpenCurrentDatabase(@"c:\dsdata\db3.mdb", false, string.Empty);
app.ExportXML(Microsoft.Office.Interop.Access.AcExportXMLObjectType
.acExportReport, "rptTest", @"c:\dsdata\XmlTest.xml", string.Empty,
string.Empty, string.Empty, Microsoft.Office.Interop.Access
.AcExportXMLEncoding.acUTF8, Microsoft.Office.Interop.Access
.AcExportXMLOtherFlags.acPersistReportML, string.Empty, null);
app.CloseCurrentDatabase();
}
}
}
 
Back
Top