Close excel file after reading data

i need to close workbook opened file in memory after reading and save data
becuse user when he tray to open file he opened as read only because it opened by other user (aspose workbook)

this my code

Aspose.Cells.Workbook workbook = new Aspose.Cells.Workbook(AttachedFile);

                MemoryStream ms = new MemoryStream();
                workbook.Save(ms, Aspose.Cells.SaveFormat.MHtml);
                ms.Position = 0;
                StreamReader sr = new StreamReader(ms);
                HtmlBody = sr.ReadToEnd();
                workbook.Dispose();
                ms.Close();
                sr.Close();

@senior,

Thanks for the query and sample code.

Your code looks to me Ok. Do you find any issue with it or you need something else? Please elaborate your issue with complete details and samples, we will check it soon.

PS. please also see the reply here for your reference:

my file in shared folder every day some one need to update data and to send automatically by email
when he tray to open the file he get it’s used by other user and can’t open for editing

@senior,

Do you mean he gets an exception (i.e., the file is used by another user/process…etc.) when open the file by Aspose.Cells APIs (via the line of code, e.g Workbook workbook = new Workbook(filePath);)? Please provide us your template file, sample code (runnable) and steps (involved) to reproduce the issue on our end, we will check it soon.