The most common request I had received as feedback for my Nitnem App for Windows Phone, is to add Sukhmani Sahib to it. However, I wanted to take into account other requests like adding meanings as well. So, I have created this new app for Windows phone specifically for reading Sukhmani Sahib.

This version has following features:

  • Read Sukhmani Sahib, one Ashtpadi at a time
  • Transliteration in English language
  • Line by line meanings in English language
  • Ability to change font size
  • Ability to turn transliteration and meanings off
  • Adaptive UI that transforms as per your currently selected theme color

Here are couple of screenshots of the app:

I request all to install this app, and also share your feedback/reviews from Windows Phone Store.

 

Today a major update of my Nitnem app on Windows Phone got published. It has lot of new features and improvements like:

  • Increase/decrease font size
  • Change Color scheme used
  • Auto Scroll while reading

Here are few screenshots…

 

You can read about more details, reviews and install it from Windows Phone store.

 

 

While working on document generation on server side, where Open XML SDK is the tool for a developer, I came across a scenario where the requirement was to generate Open XML based Excel Workbooks (XLSX), from older format of Excel Workbooks (XLS) files which contained a huge amount of data, like million rows in a single sheet!

We were able to employ XSL Transform technique to very effeciently generate a part (sheet.xml) of Open XML workbook. I have talked about this whole scenario at the following post:

How to efficiently generate OpenXML Workbook from Excel files containing very large amount of data – Visual Studio Office Development (VSOD) Support Team – Site Home – MSDN Blogs

This method is quite fast as well as extensible. During my testing, the generation of an Open XML workbook from a data XML containing around 1150 rows with 30+ columns each, took even less than a second to generate. Also, this technique can be extended to pull in data from a back-end database as XML and generate Open XML workbooks on the fly.

Have a look into this article and feel free to drop you comments/queries here or on the above post, I will surely try to answer them.

Hello everyone! In the last post we left off with a small example of how to automate Microsoft Office applications from our custom solutions. This week we are going to discuss about what does Microsoft Office object model means, and will discuss about various classes/interfaces available in the Office applications.

As I had mentioned earlier, Microsoft Office applications (from now on, wherever I mentions this term, I am referring to Microsoft Word, Excel, and PowerPoint) are also COM (Component Object Model) servers. This enables them to provide a way for developers to use their features in other programs.

As a developer, all you need to do is call a function to launch the server, and once it is up and running, you can ask for the various interfaces provided by the server and utilize its functionality into your application.

The task of launching an Office application from your program can be performed in different ways depending on whether you are linking to the COM server’s type library statically, or you want to launch it dynamically. While linking statically, all you need to do is call the constructor of the main class of the COM Server and then you can access the other Interfaces by using properties/methods of the main class object. Linking dynamically involves calling CoCreateInstance API specifying either the CSLID or ProgID of the application to launch. In the example code of my previous post, we have seen the static linking technique.

Each of the Office applications provide their main class by the name Application, and rest of the Interfaces/Classes that we can use are exposed as Properties of the Application class. It represents a running instance of the Sever and provides methods to manipulate its state like, activating it, setting its visibility etc.

After the Application class, each Office application provides a class that represents the document it works on. In case of Word it is Document class, for Excel it is called Workbook and in case of PowerPoint it is named as Presentation. The Application class maintains the list of all currently opened documents and provides a property that represents this collection. To access a particular document, we need to first get the collection and then find our required document object.

In case of Excel and PowerPoint, each working document contains another level of isolation for its contents. Excel provides separate Worksheets in a workbook and a PowerPoint presentation contains various Slides. You might say that even Word documents contain various Pages, and you are very right. However, Word doesn’t provide page as another isolation of its content. All of the content of a document is represented by the Document class only.

Ok, I think that is enough of the theory; let’s see how this architecture of Office applications can be depicted:

 Office Object Model Architecture

As shown above, Range class is common to Word and Excel, and it represents the portion of the content that can be manipulated with these applications. In case of Word, it could represent a paragraph, a line of text, or a single word. In case of Excel, it represents a collection of Cells, or a particular cell. In PowerPoint, the content of a slide is represented by a collection of Shapes, i.e., each item of a slide in PowerPoint is a shape.

A point to be noted here is that even though I have mentioned Range/Shape as THE object to manipulate content in Office application, it not the only one. There are other objects, too, that can be used to play around with the content of these applications. Here is a small list of such objects:

  • Word
    • Selection – type of Range object
    • Shapes – represents drawings, embedded images or objects, etc.
    • InlineShapes – shapes that are displayed in-line with text
  • Excel
    • Rows – Range object representing a row of data in Excel
    • Columns – Range object representing a column of data in Excel
    • Cells – another Range object, for a single/multiple cell(s)
    • Shapes – represents drawings, embedded images or objects etc.
    • Selection – Represents any selected item on the sheet, could be a Cell, a Range of cells, or a Shape etc.
  • PowerPoint
    • Selection – represents a currently selected object on the slide
    • SlideRange – object to manipulate single or multiple slides
    • TextRange – object to manipulate a selected piece of text
    • ShapeRange – object representing a collection of shapes

In Part-1 of this post, we saw code snippets in VC++ and C# to insert a piece of text in a Word document. If you were to implement similar task for an Excel workbook or a PowerPoint Presentation, you can very easily implement it by knowing what type of object you should work with. For instance, you can use Range or Cell object in Excel, and you can use Shape object in case of PowerPoint.

With this, I am going to end this post. I am sure this post has broadened your view of how to work with Office applications. You can also refer to Microsoft Office SDK Documentation and Developer References for more details and list of other classes/objects available to you.

In case you have any queries, please feel free to drop in your comments; I will be more than happy to respond.

It has been a while when I last posted something… and with this post I am making a comeback :D

While working with Word during these days, I encountered a scenario where, if I had an Alternate Data Stream (ADS) associated with Word 97-2003 format document and I converted it to the newest format (DOCX format) in Word 2007, the associated ADS would get lost and there is no way to recover it.

I have posted a programmatic solution to retain this ADS when a document gets converted at:

Visual Studio Office Development (VSOD) Support Team : How to retain alternate data stream associated with a word document while converting it to newer file format version