Hi,
I have a template xlsm file that I import using Radspreadprocessing. If you look at the code it's pretty straightorward.
Telerik.Windows.Documents.Spreadsheet.Model.Workbook wb; Telerik.Windows.Documents.Spreadsheet.FormatProviders.IWorkbookFormatProvider fp = new Telerik.Windows.Documents.Spreadsheet.FormatProviders.OpenXml.Xlsm.XlsmFormatProvider(); On the original imported xlsm, there is a button that runs a macro on the wsRefresh sheeet.
However, when I export the modified input xlsxm the button disappears.
I haven't a clue what I am doing wrong.
Any help would be great.
Thanks ... Ed
using (Stream input = new FileStream(filePath, FileMode.Open)) { wb = fp.Import(input); } WebClient wc = new WebClient(); Worksheet wsPivot; Worksheet wsData; Worksheet wsRefresh; wsPivot = wb.Worksheets.GetByName("Pivot"); wsData = wb.Worksheets.GetByName("Data"); wsRefresh = wb.Worksheets.GetByName("Refresh"); int row; if (dtFilters.Rows.Count > 0 && wsData != null) { for (int i = 0; i < dtFilters.Rows.Count; i++) { row = i + 2; copy data from the app to the spreadsheet(s) } } using (MemoryStream stream = new MemoryStream()) { fp.Export(wb, stream); //var content = stream.ToArray(); bytes = stream.ToArray(); Response.ClearHeaders(); Response.ClearContent(); Response.AppendHeader("content-disposition", "attachment; filename=SeedplanReport.xlsm"); Response.ContentType = "application/vnd.ms-excel";//"application /vnd.openxmlformats-officedocument.spreadsheetml.sheet"; Response.BinaryWrite(bytes); //content Response.End(); }
Hi I'm just reposting the question with a little better formatting here.
I have a template xlsm file that I import using Radspreadprocessing. If you look at the code it's pretty straightorward.
Hi Ed,
Your code seems ok and I am not sure why the button is lost. I would suggest opening a new ticket which is a private thread. This way you can attach your file so we can test this with it. This will allow us to determine what is causing the undesired behavior.
Thank you in advance for your patience and cooperation.