Thursday, February 24, 2011

HTML to PDF component: A review of ExpertPDF

Often I am converting HTML documents to PDF, as this seems to be the easiest way to create dynamic PDF’s populated with a variety of data.  ExpertPDF has been my favorite tool and I wanted to share my latest experience.  Their site was not the prettiest site, and the feature list was a little too much to read.  It would have been nice to be able to see a list of features, than a release schedule.  I was initially hesitant in trying out yet another component for converting HTML to PDF.

html-to-pdf-expert-boxThe install went quick, and I added the component as a reference to an existing project I was working with.  I wanted quickly get to where the rubber meets the road to see what the PDF would look like an a report I was having challenges getting to render properly.  My quick test was to set anonymous access to file, and point the tool to the page.  I was amazed at the speed and clarity of the PDF.  It rendered perfectly out of the gates.

Anonymous access to HTML files is not very common in my world, so I needed to get in to the security and figure out how to lock my report back down, but still be able to get the rendering engine to load my PDF.  The security credentials were easy to load, and the sample code that ExperPDF had put together showed 2 methods, one of which was to use the credentials of the current user, rather than some server side credentials.  This was a nice bonus.

After locking down the HTML report (aspx page), and wanted to try something a little more challenging.  I needed to render a PDF with custom margins, orientation, header, footer, etc… and then secure it before the emailed it off.  Another set of tasks that just came easy with ExpertPDF.  The level of control that the control provides has been outstanding.  Their documentation is easy to follow and the processes make sense.

Tuesday, February 15, 2011

Spell Check Control–c#, vb.NET and beyond

Before going in to my review of Infragistics Spell Check control, and how it compares to other controls I’ve used, I’m going to discuss the importance of spellcheck.  If you want to skip down to the review, click here.
Original Article written by Joshua Shackelford (IT Expediter, Systems Analyst, IT Liaison)

Communication getting Relaxed

world_of_communication_poster_400It is amazing at how lax communication has become.  With so many quick methods for communicating, less thought is going in to our communications.  As more methods move mainstream, and become part of everyday life, more people are communicating less professionally.  As a professional you need to take the time to use proper case, punctuation and spell check.  It can be a poor reflection on you and your business if you do not.  Even as I type this, Live Writer is constantly underlining misspelt words, forcing me to correct the words before publishing my post.

Recently I was tasked with adding Spell Check to a thick client application that has been in development for over 5 years.  As soon as it was brought up I thought, “Why didn’t we do this sooner?”.  This particular application focuses on transportation maintenance management, and the maintenance managers commented that they want spell check added to work orders, and comments, so that they can correct their spelling before these reports get passed up to corporate.  Before, nobody ever thought of who might eventually read their work orders, but as the company pushes more on professionalism, the importance of every communication portraying their skill and dedication to the business, as risen to the surface.

When tasked with adding spell check throughout the application, I first went to Google.  I was looking for a free solution spell check component that I could quickly integrate through out the solution.  The first suggestion was using Microsoft Word’s Interop to leverage the spell check capabilities behind Microsoft, but I wasn’t thrilled with the prospect of being tied to a 3rd party application.  We did have a discussion as to whether or not this was a feasible requirement for our end users to have Microsoft Word installed.  Most (if not all) of our users do have Microsoft Word installed, but we were hoping to find a better solution.

communication_cdRecently I’ve been working on a web based .NET application for an insurance company.  We use Telerik’s suite of tools within that application.  They have an ASP.NET spell check control, that we have integrated with parts of the application.  It was not the greatest thing to integrate, but I was hoping that their WinForms version might be better.  Unfortunately, it turned out that they don’t yet offer a WinForms Spell Check control.

Next I discovered NHunspell.  This looked very promising. I downloaded the libraries, and started working with it.  It looked like it was going to get the job done, but there were a lot of little features that I wanted (red squiggle underline, right click correction options, pop-up replacement, custom dictionary, etc), but would have to build out myself.  I was up to the challenge, but could not get over the fact that spell check has been around for so long, that there should be a faster way to implement all of these features.  Hopefully one day, someone, will write a nice library based on the free spell check component NHunspell.

Review of Infragistics’ Spell Check Control for WinForms

We use the Infragistics suite of tools within this project currently, but I had forgotten that they have a spell check control.  After realizing that we already had a spell check control here at our fingertips, that should already be fully developed, I removed the NHunspell code that I had started, and started down this new path.  It was amazingly simple.  I added the component as a reference, dragged it to the form, and then enabled it for each of the text boxes that we wanted spell check on.  I was shocked at how simple it was.  I ran the application, and all of my mistyped words had red squiggles under them.

social-network-communicationNext it was time to add some of the other “bonus” features that we have all come to love.  Right-click context menu with spelling options was added with ease, just following the Infragistics sample code.  To make sure that it worked, I added it to a specific control on the form, but then later was able to move it to a generic function so that I could quickly add this feature to any text box.  It worked out great.  The only thing I wasn’t thrilled with, was that the new context menu replaced the default context menu that had copy and paste options.  Eventually I want to go back and figure out how to get the original context menu back, if there are no misspelt words.

Pop-up spelling correction was just a matter of invoking a method built into the Infragistics spell check control to show the dialog box.  I was disappointed that I could quickly loop through all controls that had spell check enabled, in order to invoke this method.  However, this was remedied rather quickly within the previously created function for adding and initializing other spell check features.

The last feature I really wanted to be part of this release was a shared dictionary.  In order to share the dictionary amongst all users, I wanted the dictionary of words to be stored in the database.  I did not see anything within the library where I could just point it to a table, or database, so back to the drawing board.  I elected to add a few more functions to the now growing spell check helper utility.  I added methods to complete the following, sync local text file dictionary to a new database word dictionary table, sync database to local text file, and then a method to perform 2 way synchronization.  Calls to these methods are triggered when a user adds a word to the user dictionary, or by clicking an option manually within the context menu to synchronize with the dictionary.

dotnet_componentI am so glad that Infragistics had included the WinForm spell check component amongst their suite of tools, but even if we hadn’t already owned it, I would at this point gladly have purchased it.  It was a great library to work with, and has added a very professional feature to our application, that no only will make our application a stronger application, but will reflect on the staff that use it as they are portrayed in a better light to their corporate management team.

IT Liaison - Translating executive requests into geek for the common IT guy