Access to office 2003 files - c#

I want to access to office 2003 files (.doc, .xls and .ppt) in order to extract text and some metadata (number of words, number of sheets, pictures, template, etc.). I'm able to do it with Open XML SDK for office 2007 documents. However, this extracton will take place on a server, which can't have apps like Microsoft Office installed (that's the reason why I can't use Office's Interop).
I have tried NPOI, however actually it only supports .xls files. The other libraries that I found are not open-source, I can't use it on my work... I downloaded NPOI Scratchpad but the code is very "raw", I can't use it on my work.
Do you have any other idea to get the text and metadata from office 2003 documents? I'm not a very experienced programmer, and I'm using C# (However, if there is any solution to this problem in C++ I could consider to use it). Thanks.

There are many libraries like:
ClosedXML (Office 2007)
EPPlus (Office 2007)
Aspose cells(Office 97-2010, I use this one)
I don't know any free libraries supporting office 2003 format.
good luck

Related

OpenXML alternative for Microsoft Office Interops "SelectContentControlsByTitle" in C#

The project in which I'm involved has a requirement of generating Word documents.
Initially, I used Interop to achieve this. But since Interop requires the clients to have Office installed on their machines, I switched over to OpenXML instead.
Interop has a nice method for getting Content Controls by title "SelectContentControlsByTitle", is there any alternative to this in OpenXML?
Cheers!

Applying a template file (dot) to a word document without office installed on the server

I am trying to apply a template file (dot) to a word document (doc) on a server where office is not installed. I tried NPOI, but their libraries (XWPFDocument) support only docx and dotx formats. The library HWPFDocument that supports 97-2003 formats (doc and dot) is apparently going to available, but as of now available only as a scratchpad option.
Is there a way of doing the job at hand without installing office on the server?
I am working with .net 4.0 and coding in VB.Net.

How to create Word document in WinRT

I'm currently developing application using WinRT/C#. It is second version, first was developed on WPF. In application I need to generate some reports and export them into MS Word document.
In first version of application I used MS Office Interop to export reports in MS Word, but in WinRT there is no support of MS Office Interop. Is there any simple way to create MS Word document in WinRT? (I know there are third party libraries like Syncfusion for WinRT but I would prefer to not use them).
You won't be able to use MS Office interop from a Windows Store app. You could use Open XML SDK, though. It is also available on NuGet and seems to be WinRT compatible.
Using it won't be as easy as working with interop classes and you'll only be able to create XML based docx files, not binary doc files. On the other hand your users won't need to have Word installed and they'll be able to open the files in other Office suites like OpenOffice or LibreOffice. There's a set of tutorials available on MSDN to get you started.
There is a free solution that consiste to format your document in rtf.
For this i create a new librairy to help a developper to create a document compatible with word.
you can find this there : https://github.com/crogun/WinRTF-For-WinRT
the code is open source, and you can extend it if you want.

Can I create an Excel sheet using the C# without MS Office installed?

Can I create an Excel sheet using the C# without having MS Office installed on the host machine?
If you are targetting Office 2007+ - you can take a look at the the Office Open XML. Your .xlsm is basically a compressed XML file and as long as you are not doing anything fancy - it should be easy to generate.
If however - you are targeting Office 2003 or earlier - the .xls is a binary format. You might need to look at abiword or star office to see if you can use any of their code to serialize you data to it.
I have achieved this using the EPPlus library.
In the past I've created a simple HTML table and saved as .xls and this has opened fine in Excel.

using ms office com objects in other systems without have office installed

i wrote a app for reading excel files.i had to add some references to Microsoft office Com Objects.
it worked good in my system,but when i wanted to use it in other system in which does`t had ms office installed ,
i encounter a problem.i also carried dll files that has been added to project . what should i do ?
In order to use the relevant object libraries you'll have to make sure that Office (Excel in your case) is installed on your client machine. If you have the option I'd suggest to switch to the Open Office XML format anyways. I recently had a similar problem with MS Word and the +work to switch to the new format has def. payed of.
Check MS Open XML SDK
Performace++ and not depending on Office installed...
The Office COM objects depend on Office. You should either arrange for Office to be installed on the other systems, or use a component for reading Excel files that doesn't need Excel installed, such as the ODBC Excel driver or a third-party Excel file reader.

Categories