i have to convert a word doc into pdf and print it and Microsoft.Office.interop offers an easy way to do it but client machine has be installed with 2013 or higher.
My question is. is there any way that i could convert the word file into pdf using Server's Microsoft office because i can't expect client have 2013 installed on their pc
if no is there any easy and free way to convert word file into pdf.?
Thanks all
Word Automation Services (part of SharePoint) can convert Word documents to PDF (and other file formats) in the server environment.
It is not recommended to use Office Interop on server.
You can use OpenXML for working with office docs.
There are many examples available here.
For conversion, you will have to use separate plugin, and I'm not aware of a free version to convert to PDF.
Related
I have developped a program (C shrap) which help schools in archiving there documents, in the program, I am using Microsoft Word, Excel and Access integrations, But I dont know if the target PC will have MS office, so, is there a way to target these PCs without requesting MS office installed?
My references:
Microsoft.Office.Interop.Excel
Microsoft.Office.Interop.word
If you use Interop then you need office install.
I suggest instead using other libraries which don't need Office, such as the openxml sdk.
You can find various examples online on how to do this. Here are a few
https://www.codingame.com/playgrounds/11047/edit-word-documents-using-openxml-and-c-without-automationinterop
https://www.codeproject.com/Articles/87711/Manipulate-Docx-with-C-without-Microsoft-Word-inst
Do we need Office Installation to work with OpenXML?
https://github.com/OfficeDev/Open-XML-SDK
Can anybody get some link to library for work with Word Document of format *.doc.
I need the library which not require that Word or any other Office dependencies be installed on the server machine.
I use Microsoft.Office.Interop.Word library, but it fail on service.
Try Aspose Words for .Net http://www.aspose.com it is not free, but it works well.
I'm working to create and read MS Excel file in asp.net web application.
I'm not sure that it requires to install Microsoft Excel on server or not.
I don't want to install any licensed product on the server like MS office etc.
Please let me know how i can implement this functionality without installing MS Excel on the server or it is necessary to install MS excel on server?
Thanks
It depends on what you're doing, but more than likely, all you need is the Microsoft Access Database Engine.
This download will install a set of components that facilitate the
transfer of data between existing Microsoft Office files such as
Microsoft Office Access 2010 (*.mdb and .accdb) files and Microsoft
Office Excel 2010 (.xls, *.xlsx, and *.xlsb) files to other data
sources such as Microsoft SQL Server. Connectivity to existing text
files is also supported. ODBC and OLEDB drivers are installed for
application developers to use in developing their applications with
connectivity to Office file formats.
Edit, in response to
I just want to read and write MS excel files but i don't want to install anything on the server.
You can try EPPlus, which seems to solve your problem; though I've never tried it.
EPPlus is a .net library that reads and writes Excel 2007/2010 files using the Open Office Xml format (xlsx).
No it isn't necessary to install a full version of Microsoft Office. You can just use ODBC or OLE to open the files, provided you just need to do simple operations like read rows in worksheets (as if they were tables).
Use http://www.connectionstrings.com/ to look up the various .NET ways of accessing Excel using ODBC and OLE.
Effectively you need to treat the .xls and .xslx files as if you were querying an SQL database.
About Microsoft.Office.Interop.Word.
I installed the PIA and Microsoft Office 2010 in my web server, but I can't generate a .doc when I run the application published in my web server. When I run my application in localhost, works fine, and generate the .doc file.
I have to do some configuration in server side to allow the generation of .doc files ?
Remember that Office 2010 was not designed to run inside a web server (e.g., thread safety might not be guaranteed), so you might encounter more difficulties down the line.
Instead, consider using the Open SDK 2.0 from Microsoft, which allows you to manipulate (create, edit) Office 2010 documents, which are simply packaged (zipped) XML files. This technology is much better suited for server use. It also doesn't require you to have a separate Office 2010 license for each web server where you are going to install Office 2010.
You should be using the Open XML SDK for this. The office interops are outdated relics, and should not be used.
Download link:
http://www.microsoft.com/download/en/details.aspx?id=5124
Here's a simple example of how to create a Word document:
public void HelloWorld(string docName)
{
// Create a Wordprocessing document.
using (WordprocessingDocument package = WordprocessingDocument.Create(docName, WordprocessingDocumentType.Document))
{
// Add a new main document part.
package.AddMainDocumentPart();
// Create the Document DOM.
package.MainDocumentPart.Document =
new Document(
new Body(
new Paragraph(
new Run(
new Text("Hello World!")))));
// Save changes to the main document part.
package.MainDocumentPart.Document.Save();
}
}
See this MSDN article for more details:
http://msdn.microsoft.com/en-us/library/dd440953%28v=office.12%29.aspx
Office Interop is NOT supported by MS in "server-like scenarios" (which IIS/ASP.NET is a special kind of)... see http://support.microsoft.com/default.aspx?scid=kb;EN-US;q257757#kb2
Your options include several libtraries (free and commercial) - for example:
MS OpenXML SDK (free)
Aspose.Words (commercial)
Regarding the exception you get:
Since Windows Vista several changes have been introduced to stop any Windows Service (IIS is just some special one) from doing anything "desktop-like" - this is due to security issues... to resolve such a situation you would need to circumvent those security measures implemented by MS - which I absolutely do NOT recommend...
do i need to install Microsoft Excel to be able to export xls file in c#,
I have my application it run in my pc but when I test it in another pc that it don't contain
Excel the application got errors !!
I see this link Using Microsoft.Office.Interop.Excel without actually having Excel?, I called my client and he tell me that he use open office and Microsoft office, I can use more than library
Depending on what you need you can use some library (free or commercial) for this:
OpenXML 2.0 from MS
Aspose.Cells (commercial)
Flexcel (commercial)
Create Excel (.XLS and .XLSX) file from C#