Please Read This Article . http://support.microsoft.com/kb/322091
this Article Send File & String To Printer With Binary Format.
But One Problem . Can Not Create File XPS Or Save XPS File From "Microsoft XPs Document Writer" Printer .
If seting di.OutPutFile Equal File Address ("D:\test.xps") . Create File But File is ill And XPS Viewer Not Open File.
what is Problem ? Please help Me!.
You can do it like this or this for pdf/word. You can also use 2007 Microsoft Office Add-in: Microsoft Save as PDF or XPS, like this
Related
I want to create a .xls file using OpenXML SDK. I am able to create .xlsx and .xlsm files but when i save it as .xls and open in my system it pops an error. Then I have to do save as again for it to work properly.
Is there any way to save files directly in .xls format?
Simple answer is No, you cannot do it.
The reason being .xls format is proprietary to Microsoft. OpenXml SDK cannot understand or write to that format.
If you want to store data in .xls format, then you need to use Microsoft office excel interop objects.
Excel namespace interop
If you indeed want to take the route of adding interops to your application to save to .xls format, I would also suggest you to look into following SO answer because adding reference to interop objects in .NET core is not straight forward.
ms interop in .net core
I'm new and have a question. Hoping that someone can help. I have received an Excel Document with embedded PDF Objects (first picture).
Embedded Adobe Acrobat PDF:
I can't open it, because Acrobat Reader isn't installed and i have not the rights to install software.
Error message in German:
I want to change the related program to pdf-xchange editor. Can anyone give me suggestions how to do that?
Embedded pdf which is working:
By the way: pdf-xchange editor is not listed in the object type list.
Object list:
I don't want to save them on disc, just have the possibility to permanently open them, when I need it.
I hope you understand my Problem. Thanks in advance.
Patrik
I am using outlook mail api to receive and show mail content which can also include attachments of any type. I had managed to show pdf files using pdf-view module but for excel and doc files no such module or anything exist.Could anyone suggest something for this.Any help would be appreciated.Thank you
So what I found from my research is you can not display a word file using java script or angular, it only opens up a dialog box to download the file.
As an alternate what you can do is convert word file to HTML and preview it in browser. Mammoth.JS is the best option for this.
I'm using Open XML to open an excel file as in:
using (SpreadsheetDocument myWorkbook = SpreadsheetDocument.Open("generated.xlsx", true))
...
but I cannot figure out how to actually launch excel and show the file through code.
Thanks for any help.
Take a look at either one of these answers:
how to create and download excel document using asp.net
OpenXML file download without temporary file
I am trying to use Interop.Excell to save an Excel Workbook as a PDF file. I am using VS2008 and Office2007, and have downloaded and installed the SaveAsPDFandXPS.exe from Microsoft. This enabled me to save a Word document as a pdf using the following code:
object frmt = Microsoft.Office.Interop.Word.WdSaveFormat.wdFormatPDF;
wrd.ActiveDocument.SaveAs(ref dest, ref frmt, ref unknown, ref unknown,...
Pretty cool excpet for the whole Interop thing.
Anyway, I have been unsucsessful in finding a parallel in Interop.Excell for the Word.WdSaveFormat.wdFormatPDF. The Workbook.SaveAs takes a Interop.Excel.XlFileFormat, but there is no option for a pdf format. Has anyone done this or has experience in this area?
This question has been answered here:
What is the FileType number for PDF in Excel 2007 that is needed to save a file as PDF through the API?
You need to call the Workbook.ExportAsFixedFormat method:
ActiveWorkbook.ExportAsFixedFormat Type:=xlTypePDF
FileName:=“sales.pdf”
Quality:=xlQualityStandard
DisplayFileAfterPublish:=True
This method should be preferred over using SaveAs because it also allows specifying all PDF / XPS options.
Note: This method has been added to the Excel object model with Excel 2007 and requires the Save as PDF or XPS Add-in for 2007 Microsoft Office programs (or SP2) to be installed.
According to Microsoft, the constant to use with Workbook.SaveAs to save as a PDF is 57.
"The pdf format is not listed here. However it has number 57."
From:
http://msdn.microsoft.com/en-us/library/bb241279%28office.12%29.aspx