We're sorry Aspose doesn't work properply without JavaScript enabled.

Free Support Forum - aspose.com

Closing the application with pdf doocument opened

Hi All,

I am generating a pdf doccument from an xls sheet on click of button in windows forms with following code and i am opening the created pdf doccumnet using System.Windows.Diagnostics.Process.Start("name") :

private void button8_Click(object sender, EventArgs e)


wb = new Workbook();

FileStream fstream = new FileStream("C:\\download.xls", FileMode.Open);

//Opening the Excel file through the file stream


//Adding a new worksheet to the Workbook object

//Obtaining the reference of the newly added worksheet by passing its sheet index

Worksheet worksheet = wb.Worksheets[0];

worksheet.Name = "My Worksheet";

//Saving the Excel file

wb.Save("c:\\samplesearch.xml", FileFormatType.AsposePdf);

pdf2 = new Pdf();

pdf2.BindXML("c:\\samplesearch.xml", null);



//System.Diagnostics.Process.Start(Path.Combine(Path.GetDirectoryName(Application.ExecutablePath), string.Format("{0}.{1}","sample" ,"doc")));

proc = System.Diagnostics.Process.Start("C:\\samplesearchpdf.pdf");


Now if i close the form(application) i am getting an error that process is already in use.So,

i am closing the process in form close event and trying to delete the file from disk as follows:

private void Form1_FormClosed(object sender, FormClosedEventArgs e)











catch (System.IO.IOException ex)






Hello Bindu,<?xml:namespace prefix = o ns = "urn:schemas-microsoft-com:office:office" />

I have tested the issue, but I am unable to reproduce the problem. After the Pdf file is displayed, I have tried closing the application and I am not getting any error message. I am not sure why you are facing this problem. Can you please tell us, which version of Aspose.Pdf you are using.