Using C#/Java/Visual Basic to populate a Word 2007 template - c#

I've recently been given a task to populate a Word 2007 file with information retrieved from Rhapsody using the Rhapsody API. I'm not super familiar with Rhapsody, but I'll learn. I'm having difficulty tracking down a good way to write a program that can write to a formatted (read: tables) word document. I'm best at java, but I'm capable of using C#, C++, or VB. The problem seems to be that all options for java require the use of 3rd party libraries, and I'm not sure if I'm comfortable using them. All of the languages available in the Microsoft Visual Studio seem to have options for writing out to a Word Document, but I can't seem to figure them out. What would be my simplest option in attempting to tackle this task?

Aspose words does a really good job integrating C# with MS word.
http://www.aspose.com/categories/.net-components/aspose.words-for-.net/default.aspx

I am not sure if you already tried all features of Rhapsody Reporter Plus (in built) and Rational Publishing Engine (additional licenses might be required). With them you can produce html, pdf, word documents...
If this is not your use case and you need your own plug ins in java, we have good experiences with Apache POI, which I could recommend.
I don't understand why you might have issues using 3rd party libraries, when you write everything by yourself you might end doing such a similar library, expending of course "some" time and "some" headaches until having it ready...

Related

How to do ebMS3 AS4 messaging from C# client application

I am looking out for developing a C# application which posts message to a ebMS3 platform using AS4. I am new to this area. Could anyone please help? Is there any third party libraries to do this easily? If not, how we post messages using AS4 from a c# solution.
I have just implemented our own AS4 solution, and it is hard task to accomplish. Especially because .NET does not support SOAP with attachments out of the box. And there is a lot background knowledge you need to know about - all the different specifications AS4 is based on. I have not been able to find an AS4 API written in .NET without it being a standalone solution as well...
First thing is to understand AS4, and a good place to start is this blog:
https://www.codit.eu/blog/2016/02/03/as4-for-dummies-part-ii-messaging-overview/
And then you will have to understand most of the EBMS3 specification:
http://docs.oasis-open.org/ebxml-msg/ebms/v3.0/core/ebms_core-3.0-spec.html
That being said - it is not impossible.
I have been looking at the AS4.NET framework as Sander talks about, and it is well-written and a very good starting point for exchanging AS4 messages. I have used it as a test-endpoint.
So unless you need to incorporate AS4 directly into an existing product (which we needed to), I can only recommend using AS4.NET.
AS4.NET is also open source (and e-SENS profile conformant), so you can have a look at their code-base and let you inspire by the hard parts in AS4.
For the MIME parts I can recommend Mimekit: https://github.com/jstedfast/MimeKit
And for some of the encryption/signing stuff Bouncycastle is great: http://www.bouncycastle.org/csharp/
Not sure whether it can be used as a library, but for a project within the European Commission an open source .NET based AS4 implementation was developed. You can find it here in the EC's code repository. I don't know if there is any support on this, so if that is important you should probably consider another implementation. A list of solutions tested by the EC for conformance with their own profile of AS4 is available here (or if that link doesn't work by searching for "as4 conformance tested implementations")
Note that most are standalone applications which you connect to for executing the AS4 message exchange. Most offer different integration options, so you should be able to integrate it into your solution.

microsoft.office.interop.word deploy on server

I would like to convert Word Document to PDF on my local intranet Server for my company. It Is a good idea to use microsoft.office.interop.word on my project instead of buying very expensive tools that don't support Arabic at all.
I will be happy to hear an expert opinion about this case :)
it depends on your need, Third party libraries would give lots of out of the box features whereas you would need to write a lot of code to achieve the same with PIA. But if you need simple word doc to pdf conversion then PIA should do it for you.
But i would strongly recommend you to go for a wrapper assembly which would help to over come the disadvantages of using PIAs such as,
They are limited to a version, i.e. they only work with one or
certain versions of Office
They cause problems while transferring or installation on other
systems
They offer no protection mechanism in the management of COM proxies
in a nutshell, if you are a using PIA your code might not work for different version of office whereas these wrapper assemblies manage multiple office versions using Late Binding.
You can use NetOffice which I have been using in projects for some time. some of the features of NetOffice are,
Office integration without version limitations
All features of the Office versions 2000, 2002, 2003, 2007, 2010,
2013 are included
Syntactically and semantically identical to the Microsoft Interop
Assemblies
I would not go as far to say that I am an expert here, but I can at least share my journey in hopes that it would save you time and energy.
This can work fairly reliably in limited scenarios, but Microsoft will tell you up front that:
[InterOp on a Server] is not supported and will not scale well
I agree, but for simple stuff... meh.
Your first hurdle is having the correct rights to run interop. Where
to run interop is a challenge for some companies. IMHO, I would not
run it on my intranet server unless I could contain the process with
limited rights (and yes that's doable).
Your next challenge will be with virus's and the vulnerabilities of
MS Word. MS Word must be kept up to date, customers must be able to
deal with documents not getting converted (due to potential virus or
bad macros in the file).
The approach that I use is to run MS Word interop in a service or as a workflow. You need to expect to queue these requests and write your app as such. The service would work in the background and have limited rights other than to run MS Word, open a file and "Save As" PDF format (plus what ever other business logic you require). You would scale by adding more services/workflows on new servers (one interop service per machine)
When run in this manner, I have rarely had issues. I hope this helps.

Port Excel spreadsheet to c#

I been searching for the past while for an application which will port a excel workbook to c# code the closest I found was spreadsheetgear but its not of great use, I've slowly come to the conclusion that I will have to write the code myself.
Does anyone know of any freeware command line tool or opensource project which will accomplish this?
The reason that I wish to do this is simple, Excel\VBA is terribly slow even when optimized
some computations can take days, but due to is simplistic use, excel is a standard tool for model building. We have a java port which is dramatically quicker, but we are constantly updating the model and as such each minor change must be checked and recheck which takes time.
My aim is this, have a tool which will take an excel file as input parse all the formulas and values and output c# equivalent code, the few subroutines will be manually ported. A graphical design will then be manually created which will wrap around this generated code.
I have the generally code structure laid out in my mind, how I will accomplish this aswell as the libraries that I will use for reading excel files. But as I'm quite certain this is not an original problem, nor do I think the solution is overly difficult I would presume that there is some public project?
If you want to read Excel files from C# the VSTO Developer Center may be a good start.
As a side note, I think if you are trying to port general Excel applications to C# automatically you have quite a big project. For a small subset of applications where the Excel sheets follow a similar pattern it might be reasonable to do.
But to really benefit from porting Excel applications to C# you will have to rewrite them to use appropriate data structures in C#.

Commercial .NET CSV Parser/Library

Our company has pretty much banned us from using open-source libraries in our commercial products due to licensing issues. We are currently looking for a commercial .NET library that can read and parse CSV files - does anyone have any ideas ?
As far as functionality goes, I really need to be able to read a CSV file into a strongly typed DataTable - with appropriate conversion and flagging of type conversion failures.
.NET has a built-in CSV parser. A real one that follows the RFC to the letter and provides error recovery when some lines are bad but the rest of the file can be parsed.
http://msdn.microsoft.com/en-us/library/microsoft.visualbasic.fileio.textfieldparser.aspx
I think it would be well worth studying what the differences are between different open source licenses, so that you can explain to whoever is 'banning' you from using them, what they all mean and what the implications are for your company.
For instance, I would never advocate using a GPL'ed library in one of our closed source programs, but an L-GPL'ed could be made to work. Other licenses are similarly less encumbered.
Also bear in mind that just because a library is published on the web as GPL, quite often, if you email the author(s), you may find that they have other licensing options. For instance I was interested in one GPL library, emailed the author and he said he would be happy to license for closed source projects for $100 per year for support and no runtime cost (that's $100 in total for anyone in our company to use the library on any number products we ship).
This is a damn sight better than $3000 for the development version and $500 per runtime for the commercial library I was also considering. Admittedly the commercial library did much more than the open source library, but we didn't need all that extra functionality at the time.
CSVReader did the trick for us.
FileHelpers v 2.0
Sébastien Lorion's excellent CSV library is licensed under the MIT license, so you can do pretty much anything with it so long as you acknowledge the original copyright.
How about using built in OleDb in .NET with Jet Engine. It handles different file delimiter type as well. See this article
http://www.codeproject.com/KB/cs/UsingJetForImport.aspx
Try CSV Helper (which I wrote). It has a Ms-PL license. If you can use Microsoft products, you should be able to use this also.

How can I generate Excel spreadsheets on the server?

I got the requirement to output some reports as Excel 2002 spreadsheets.
Normally a job for reporting services - however - that's "not great IMO" and I hate it so for this project I used ExtJs - which doesn't do any excel output - not really - but does do the UI really, really well.
The reports will need to have outlining, grouping summaries and all sorts of formatting not available if I use the plain XML formatting. This is the one thing Reporting services does do really well. Gutted.
So... Does anyone have any suggestions for alternatives to reporting services and definitely not installing Office on the server? Crystal reports are just as "not great IMO" as RS so not that either :)
I have looked at aspose et al but they're a bit expensive and I'd like to find something open-source, if possible - such as perhaps using open office -, if I can find a way of using OOo on the server without actually installing it.
Any ideas?
If your reports are not very large perhaps you can get away using the free version of Gembox Spreadsheed?
The Perl module Spreadsheet::WriteExcel works very well at generating reports in Excel format.
SpreadsheetGear for .NET can do it and requires only ASP.NET 2.0 on the server (no reliance on Excel or any other libraries).
You can see live ASP.NET (VB and C#) Excel Reporting samples here.
If performance is important at all, I would suggest running your own performance tests with your actual data and formatting as you compare your options.
Disclaimer: I own SpreadsheetGear LLC
I ended up going the OpenXml SDK route - which is a bit of a PITA in some situs but good in others - once you get the hang of it...
The answer to this depends on budget, time and whether r not you're allowed to install coms on the server -
for us all of the above were negative,
we needed the follwing:
export of generic data
grouping of certain columns
sumarisation of certain columns
template based output
sql server reporting services offered all of this if - and only if you adhered to their rules.
what we have now is near as damn it ad-hoc reporting - using extjs for the ui, nhib for the domain castle windsor for the binding, and ooxml sdk 2.0 for the export.
if you need the code for the ulti level grouping excel output give me a shout :)
w://
I am working on (right now) a windows service that does Excel and PDF generation and merging on the server, unattended, using the SyncFusion XlsIO components.
So far this has been effective. The only limitation I have run into is the ability to read some 'legacy' html/xml based Excel formats.
Not Open Source, or free unfortunately but it is a workable option.

Categories

Resources