Application Page Ribbon & Dialogs on SharePoint 2010

One of the cool new features in SharePoint 2010 is the availability of the Office Ribbon. Using the simple XML syntax, it is quite easy to add your own Ribbon controls and tabs to existing lists, libraries, and even your own web parts. You can even add contextual ribbon tabs to web parts hosted in your own custom Application Pages.

Now it’s easy to get a “global” Ribbon by simply omitting the RegistrationId and RegistrationType attributes in the Elements.xml file. You’ll find ways of doing this in tons of blog posts all over. What is not so obvious, however, is the way to do add a Ribbon to a particular Application Page when the page does not host any Web part or user control. So here’s some help for you. I’ll also take a look at interacting with a modal dialog using the new framework in SharePoint from this ribbon.

More...


Tags: , , ,
Categories: Development | Office | SharePoint

12 Comments
Actions: E-mail | Permalink | Comment RSSRSS comment feed

Convert/Display PDF & Word Files as Images in .NET

Recently I had to write some code as a sample to be able to display Word and Acrobat files on a Web page in a 2-page view. We couldn’t simply use a plugin or application on the user’s machine to do so. The solution was to export each page out to an image and then display the pages in any way we needed. We therefore needed to do some document export code from our application.

Word to Images

Converting Word files (.DOC & .DOCX) to images was fairly simple, although I do think I probably took a longer approach. The problem is that the older DOC format and the newer DOCX format have different APIs to work with. So instead of doing this, I simply exported them both to XPS and then used the XPS API to retrieve images for each page. This last part was not obvious to me till I found the one line of code required to do this on a forum – I apologize for not linking to this as I can’t find that link anymore. The credit for that part is wholly the original author’s.

PDF to Images

Converting PDF to images was a major issue. There is no direct way of doing this. There are many 3rd party components that are available to do this, but most of them cost a bomb. Some free ones like PDFSharp are able to iterate pages but there is no way to export a complete page to an image without walking through the entire structure of the page and redrawing everything.

This is where I found the GFLAX library. This requires GhostScript for Windows to be installed on the machine as well. You can register the DLL and then reference it in your .NET code.

Code Sample

I’m attaching the entire code sample to this post as a download. The code is released with the open source BSD license. All external components (Word and Office interop assemblies, GFL, etc.) have the copyright of their owners and must be adhered to.

Usage

Once you download the attachment and extract it, open it in Visual Studio 2008. Make sure you’ve installed GhostScript from the link above and run a “regsvr32 GFLAX.dll” for the GFLAX Library. Add reference to Microsoft.Office.Interop.Word on your machine (and remove the marked lines from Web.config) from the .NET tab and to GFLAX from the COM tab.

Run the application and upload .doc, .docx and .pdf files and you can then view them in the browser directly.

WordDisplay 
Two page display of an uploaded Word file. Works with PDF files too.

Download:
Tags: , , ,
Categories: ASP.NET | Development | Office | Tips | Download

7 Comments
Actions: E-mail | Permalink | Comment RSSRSS comment feed

Three Articles in August 2009 PCQuest

PCQuest has just published 3 of my articles in their current issue. It was actually supposed to be 4, but the one on ASP.NET 4 got lost in the mail and a resend was received too late for this issue. You can read these articles here:

I’m also going to try and compile a list of articles I’ve written in PCQuest over the last few years and link to them here.


Tags: , , , ,
Categories: Windows 7 | SilverLight | Office | Development | ASP.NET

4 Comments
Actions: E-mail | Permalink | Comment RSSRSS comment feed

Loading Child Table Data in SilverLight & RIA Services

I’m currently working with the .NET RIA Services SDK with Silverlight 3 for getting and modifying data from the server using LINQ. Now there are a ton of samples and blog posts available that show you how to work with data from the server. However, one thing in common with all these posts is that they usually work with only one table at a time. What if you want to show the result of a join on the table? This is where a relatively unknown feature called the IncludeAttribute comes in. Let’s take an example for this to explain it in detail.

More...


Tags: , ,
Categories: Development | Tips | SilverLight

7 Comments
Actions: E-mail | Permalink | Comment RSSRSS comment feed

SilverLight 3.0 Out of Browser Mini Tutorial

SilverLight 3.0 has just been released to the web. And there is now an even more important reason to start using this great technology – running apps written for the browser can now be run as a standalone application from the user’s desktop as well. This post takes a detailed look at how you can start using this new feature. More...


Tags: , ,
Categories: Development | SilverLight

5 Comments
Actions: E-mail | Permalink | Comment RSSRSS comment feed

Windows 7 and Application Compatibilty

I’m updating my blog after a long time since I’ve been tied up in doing a large number of Windows 7 Application Compatibility workshops all across India with a number of Independent Software Vendors (ISVs) for their products. We’re basically testing out their products on the Windows 7 RC to see any issues that might surface and what they need to do to resolve them.

Most application run just fine on Windows 7. However, in the cases where there is an issue, it almost invariably turns out that the product has not been tested on Windows Vista and therefore it also fails on Windows XP. Vista and 7 have a tighter security mechanism called UAC that needs to be addressed in applications – and is something that many developers face problems with.

So here are two of the biggest issues that I’ve seen and their solutions: More...


Tags: , ,
Categories: Windows 7 | Tips | Development

8 Comments
Actions: E-mail | Permalink | Comment RSSRSS comment feed

Managed Win7 Taskbar Enhancements

Windows 7 has a ton of new enhancements right there in the Taskbar itself. A quick list of them includes:

  • Unified Launching and Switching
  • Jump Lists
  • Destinations
  • Tasks
  • Thumbnail Toolbars
  • Icon Overlays
  • Progress Bars
  • Notification Area
  • Interactive Thumbnails

Your applications too can start using these features’ in them if you want. The documentation for these are available at MSDN here. The only issue is that this is currently possible only with un-managed APIs – COM & Win32.

So what happens if you’re a .NET WinForms/WPF developer and want these features in your applications as well? Well, fear not there is a way out. There are two open source projects that allow you to use the Win7 taskbar enhancements in your managed code applications as well.

The first is a project on CodePlex called Windows 7 TaskBar Extensions. This is a new project with only a few things currently implemented but seems to be heading in the right direction for a small, lean implementation of the Taskbar features in .NET.

The second is a much more comprehensive project called very simply “Windows 7 Taskbar”. This is based upon the excellent Vista Bridge library and offers all the features that are currently possible. There are a number of sample applications as well that demonstrate many of the different features. The only part that didn’t work for me is creating Jump Lists.

So if you’re a Windows application developer and want to add the new features of Vista and Windows 7 into your application, Vista Bridge and these other two libraries are surely something that you will want to try out.


Tags: , , ,
Categories: Windows 7 | Rave | Development | Windows Vista

6 Comments
Actions: E-mail | Permalink | Comment RSSRSS comment feed

Saving Changes in Table Design in SQL Server 2008

One of the new things that happens in SQL Server 2008 is that it prevents saving table structure changes that require the table to be dropped and re-created. While this is a great feature to prevent accidents from occurring, on a developer machine it can be quite frustrating. This is the dialog you get when trying to make changes in a table design.

image

Unfortunately, this dialog doesn’t tell you where to turn this feature off! Clicking on the small “?” on the title bar does get you to a help page that tells you how to do it.

Anyway, the place to do it is Tools > Options > Designers > Table and Database Designers > Prevent saving changes that require table re-creation. Turn this option off and you will be able to save the tables again.

image


Tags: , ,
Categories: SQL Server | Tips | Development

28 Comments
Actions: E-mail | Permalink | Comment RSSRSS comment feed

Inside Outsourcing: A Hanselminutes Interview

During the Mix earlier this month, fellow Indian RD Venkat and I were walking down together for a grabbing some snacks to eat and attending the next session when we ran into Scott Hanselman. Venkat had met Scott before and I had corresponded a few times on email as well as our RD alias with him. We got talking about outsourcing and cultures in India and the US when one of the bystanders suggested that the discussion we were having was good material for an informal podcast in Hanselminutes. Next thing we knew, Scott had unboxed an entire audio recording set, took us to an empty corner of the Venetian conference area where the Mix sessions were happening and got us on recording. We talked about a bunch of stuff from outsourcing models, difference in Indian and US cultures, education and more.

You can listen to the full podcast (in various formats and download options) from here. The opinions expressed in it are completely my own and made in an informal manner. :)
Tags: ,
Categories: Development | Internet

7 Comments
Actions: E-mail | Permalink | Comment RSSRSS comment feed