Ich konvertiere Excel-Datei in PDF mit Interop. und ich habe einen Arbeitscode.Excel zu pdf mit Interop
aber vor dem Speichern in pdf. Es wird ein Dialogfeld angezeigt, in dem der Benutzer aufgefordert wird, "Änderungen an der Datei zu speichern". Wie kann ich diese Eingabe vermeiden?
und wie kann ich das Excel schließen, wenn das Speichern durchgeführt wird? Danke
public string ExceltoPdf(string excelLocation, string outputLocation)
{
try
{
Microsoft.Office.Interop.Excel.Application app = new Microsoft.Office.Interop.Excel.Application();
app.Visible = false;
Microsoft.Office.Interop.Excel.Workbook wkb = app.Workbooks.Open(excelLocation);
wkb.ExportAsFixedFormat(Microsoft.Office.Interop.Excel.XlFixedFormatType.xlTypePDF, outputLocation);
wkb.Close();
app.Quit();
return outputLocation;
}
catch (Exception ex)
{
Console.WriteLine(ex.StackTrace);
throw ex;
}
}