

Var downloadLink = document.createElement("a") ĭownloadLink.download = "meuarquivo.pdf" So, we can use the idea of an invisible link, which is still a "technical device", instead of window.open : var uri = 'data:application/pdf base64," + data xls file from Windows Explorer, locate the file that needs to be opened, and then double-click on the file, or right-click on the file and select Open. For your case, use this form of File(), but since you defined a window.open, the difficulty increases a little more. $(wnd.document).find('html').append('Um título') įor Excel, the file name must be set to Controller. An example using jQuery: var wnd = window.open("data:application/pdf base64," + data, "_blank") How can I solve these problems? Or is there any better way to return these files?įor the tab title case, you can use JavaScript. I could not change the name of the excel file that is downloaded.That way it works, but there are some issues: Window.open("data:application/ base64," + data, "_blank") So, in the success of my request I do the following to open the files: window.open("data:application/pdf base64," + data, "_blank")

You can also achieve the same thing by adding the file in the XLSart folder or using an alternate folder (both covered above in this tutorial), and then add a shortcut to the Excel program in the Windows startup folder. I already have, converting the file to byte and then converting to Base64String. Now place the Excel files or the shortcut to the Excel files that you want to open as soon as Windows starts.
#How to open excel file in new window pdf#
In this way a new tab is opened, if the file type is pdf it opens for viewing, and if the type is excel the file is downloaded.īut now I need to make the requisition per post. When the request can be made by get, I do it as follows: window.open(urlComParametros, "_blank") Here’s how you perform this conversion on your computer. Return File(new MemoryStream(ep.GetAsByteArray()), "application/", $"Relatorio.xlsx") With Microsoft Excel’s built-in options, you can quickly and easily convert your comma-separated values (CSV) files to Excel format (XLSX). My controller returns two file types: pdf and excel.
