Dato che c'ero, dopo l'implementazione per PowerPoint, mi son fatto anche quella per Visio. Ve la lascio, che magari a qualcuno serve !

using Microsoft.Office.Interop.Visio;


private static void ConvertVSD(string inputFile, string outputFile)
{
ApplicationClass visio = new ApplicationClass();
Document doc = null;

try
{
//apro il documento doc = visio.Documents.Open(inputFile);

//definisco i parametri per la conversione VisFixedFormatTypes formato = VisFixedFormatTypes.visFixedFormatPDF;
VisDocExIntent intent = VisDocExIntent.visDocExIntentPrint;
VisPrintOutRange printRange = VisPrintOutRange.visPrintAll;
object paramMissing = Type.Missing;

//converto in PDF doc.ExportAsFixedFormat(formato, outputFile, intent,
printRange, 0, 100000, false,
true, false, false, true, paramMissing);
}
catch (Exception exe)
{
Console.WriteLine(exe.Message + exe.StackTrace);
}
finally
{
if (doc != null)
{
doc.Close();
doc = null;
}
if (visio != null)
{
visio.Quit();
visio = null;
}

GC.Collect();
GC.WaitForPendingFinalizers();
GC.Collect();
GC.WaitForPendingFinalizers();
}
}

Ah, non dimenticatevi di aggiungere la reference alla libreria "Microsoft Visio 12.0 Type Library" !


TAGS: [Office 2007] [Visio] [VSTO]
Commenti(0) - Posted @ 9/12/2007 12:51:03 PM - Categoria: .NET General - Permalink - Share on twitter | facebook


COMMENTI
Non sono stati aggiungi commenti ...

INSERISCI UN COMMENTO

Nome *
Indirizzo e-mail
(non verrà pubblicato)
Commento *