<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>ManvirSingh.net &#187; excel</title>
	<atom:link href="http://www.manvirsingh.net/index.php/tag/excel/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.manvirsingh.net</link>
	<description>Manvir&#039;s Blog!</description>
	<lastBuildDate>Tue, 01 Jun 2010 09:21:59 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.0.1</generator>
		<item>
		<title>How to use XSLT to transform very large amount of data into Open XML workbook</title>
		<link>http://www.manvirsingh.net/index.php/how-to-use-xslt-to-transform-very-large-amount-of-data-into-open-xml-workbook/</link>
		<comments>http://www.manvirsingh.net/index.php/how-to-use-xslt-to-transform-very-large-amount-of-data-into-open-xml-workbook/#comments</comments>
		<pubDate>Tue, 01 Jun 2010 09:21:59 +0000</pubDate>
		<dc:creator>Manvir</dc:creator>
				<category><![CDATA[Office (General)]]></category>
		<category><![CDATA[Open XML]]></category>
		<category><![CDATA[excel]]></category>
		<category><![CDATA[xml transform]]></category>

		<guid isPermaLink="false">http://www.manvirsingh.net/?p=76</guid>
		<description><![CDATA[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 [...]]]></description>
			<content:encoded><![CDATA[<p>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!</p>
<p>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:</p>
<p><a title="How to efficiently generate OpenXML Workbook from Excel files containing very large amount of data" href="http://blogs.msdn.com/b/vsod/archive/2010/05/31/how-to-efficiently-generate-openxml-workbook-from-excel-files-containing-very-large-amount-of-data.aspx" target="_blank">How to efficiently generate OpenXML Workbook from Excel files containing very large amount of data &#8211; Visual Studio Office Development (VSOD) Support Team &#8211; Site Home &#8211; MSDN Blogs</a></p>
<p>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.</p>
<p>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.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.manvirsingh.net/index.php/how-to-use-xslt-to-transform-very-large-amount-of-data-into-open-xml-workbook/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Demystifying Microsoft Office Object Model &#8211; Part 2</title>
		<link>http://www.manvirsingh.net/index.php/demystifying-microsoft-office-object-model-part-2/</link>
		<comments>http://www.manvirsingh.net/index.php/demystifying-microsoft-office-object-model-part-2/#comments</comments>
		<pubDate>Sun, 23 May 2010 03:16:00 +0000</pubDate>
		<dc:creator>Manvir</dc:creator>
				<category><![CDATA[Office Automation]]></category>
		<category><![CDATA[automation]]></category>
		<category><![CDATA[excel]]></category>
		<category><![CDATA[office]]></category>
		<category><![CDATA[powerpoint]]></category>
		<category><![CDATA[word]]></category>

		<guid isPermaLink="false">http://www.manvirsingh.net/?p=67</guid>
		<description><![CDATA[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, [...]]]></description>
			<content:encoded><![CDATA[<p>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.</p>
<p>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.</p>
<p>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.</p>
<p>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 <em>CoCreateInstance</em> API specifying either the CSLID or ProgID of the application to launch. In the example code of my <a title="Demystifying Microsoft Office Object Model - Part 1" href="http://www.manvirsingh.net/index.php/demystifying-microsoft-office-object-model-part-i/" target="_blank">previous post</a>, we have seen the static linking technique.</p>
<p>Each of the Office applications provide their main class by the name <strong>Application</strong>, and<em> </em>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.</p>
<p>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.</p>
<p>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.</p>
<p>Ok, I think that is enough of the theory; let’s see how this architecture of Office applications can be depicted:</p>
<p> <img style="display: inline; border: 0px;" title="Office Object Model Architecture" src="http://www.manvirsingh.net/wp-content/uploads/2010/05/OOM12.png" border="0" alt="Office Object Model Architecture" width="640" height="335" /></p>
<p>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.</p>
<p>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:</p>
<ul>
<li>Word
<ul>
<li>Selection – type of Range object</li>
<li>Shapes – represents drawings, embedded images or objects, etc.</li>
<li>InlineShapes – shapes that are displayed in-line with text</li>
</ul>
</li>
<li>Excel
<ul>
<li>Rows – Range object representing a row of data in Excel</li>
<li>Columns – Range object representing a column of data in Excel</li>
<li>Cells – another Range object, for a single/multiple cell(s)</li>
<li>Shapes – represents drawings, embedded images or objects etc.</li>
<li>Selection – Represents any selected item on the sheet, could be a Cell, a Range of cells, or a Shape etc.</li>
</ul>
</li>
<li>PowerPoint
<ul>
<li>Selection – represents a currently selected object on the slide</li>
<li>SlideRange – object to manipulate single or multiple slides</li>
<li>TextRange – object to manipulate a selected piece of text</li>
<li>ShapeRange – object representing a collection of shapes</li>
</ul>
</li>
</ul>
<p>In <a title="Dymistifying Microsoft Office Object Model - Part 1" href="http://www.manvirsingh.net/index.php/demystifying-microsoft-office-object-model-part-i/" target="_blank">Part-1</a> 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.</p>
<p>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 <a href="http://msdn.microsoft.com/en-us/office/aa905496.aspx">Microsoft Office SDK Documentation and Developer References</a> for more details and list of other classes/objects available to you.</p>
<p>In case you have any queries, please feel free to drop in your comments; I will be more than happy to respond.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.manvirsingh.net/index.php/demystifying-microsoft-office-object-model-part-2/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Alternate Data Stream associated with a Word document gets lost when its converted to latest format</title>
		<link>http://www.manvirsingh.net/index.php/alternate-data-stream-associated-with-a-word-document-gets-lost-when-its-converted-to-latest-format/</link>
		<comments>http://www.manvirsingh.net/index.php/alternate-data-stream-associated-with-a-word-document-gets-lost-when-its-converted-to-latest-format/#comments</comments>
		<pubDate>Fri, 16 Apr 2010 00:11:02 +0000</pubDate>
		<dc:creator>Manvir</dc:creator>
				<category><![CDATA[Office Automation]]></category>
		<category><![CDATA[customui]]></category>
		<category><![CDATA[excel]]></category>
		<category><![CDATA[ribbonx]]></category>
		<category><![CDATA[word]]></category>

		<guid isPermaLink="false">http://www.manvirsingh.net/?p=60</guid>
		<description><![CDATA[It has been a while when I last posted something… and with this post I am making a comeback 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) [...]]]></description>
			<content:encoded><![CDATA[<p>It has been a while when I last posted something… and with this post I am making a comeback <img src='http://www.manvirsingh.net/wp-includes/images/smilies/icon_biggrin.gif' alt=':D' class='wp-smiley' /> </p>
<p>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.</p>
<p>I have posted a programmatic solution to retain this ADS when a document gets converted at:</p>
<p><a href="http://blogs.msdn.com/vsod/archive/2010/04/13/how-to-retain-alternate-data-stream-associated-with-a-word-document-while-converting-it-to-newer-file-format-version.aspx" target="_blank">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</a></p>
]]></content:encoded>
			<wfw:commentRss>http://www.manvirsingh.net/index.php/alternate-data-stream-associated-with-a-word-document-gets-lost-when-its-converted-to-latest-format/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Paste as Link of Excel Chart may fail in PowerPoint</title>
		<link>http://www.manvirsingh.net/index.php/paste-as-link-of-excel-chart-may-fail-in-powerpoint/</link>
		<comments>http://www.manvirsingh.net/index.php/paste-as-link-of-excel-chart-may-fail-in-powerpoint/#comments</comments>
		<pubDate>Thu, 18 Jun 2009 17:08:56 +0000</pubDate>
		<dc:creator>Manvir</dc:creator>
				<category><![CDATA[Office (General)]]></category>
		<category><![CDATA[excel]]></category>
		<category><![CDATA[powerpoint]]></category>

		<guid isPermaLink="false">http://www.manvirsingh.net/?p=28</guid>
		<description><![CDATA[While working with PowerPoint 2007 today I noticed a strange behavior: If you have a Chart in an Excel workbook, and you want to insert this chart as link in a PowerPoint Slide by using Paste Special, it may fail to paste anything in the slide if the current view is Outline View. Also, even [...]]]></description>
			<content:encoded><![CDATA[<p>While working with PowerPoint 2007 today I noticed a strange behavior:</p>
<p>If you have a Chart in an Excel workbook, and you want to insert this chart as link in a PowerPoint Slide by using Paste Special, it may fail to paste anything in the slide if the current view is Outline View.</p>
<p>Also, even if the current active tab on the Normal View of a PowerPoint presentation is Outline View and it has the input focus, PowerPoint will fail to paste anything. And, the stranger part is that you will not get any message box informing so!? (&#8230;not surprised!)</p>
<p><strong>How to avoid this:</strong></p>
<p>You can paste the chart by following any of the following ways:</p>
<ol>
<li>Close Pane 1 of Normal View.</li>
<li>Activate the Slides tab in Pane 1 (see screenshot below).</li>
<li>While keeping the Outline tab as selected tab in Pane 1, Activate Pane 2 (Slide pane) by clicking in it, before you select Paste Special.</li>
</ol>
<p style="text-align: center;"><img class="size-full wp-image-29 aligncenter" title="PowerPoint Panes" src="http://www.manvirsingh.net/wp-content/uploads/2009/06/powerpointpanes.jpg" alt="PowerPoint Panes" width="571" height="272" /></p>
<p> </p>
<p>Please note that you may encounter the issue even if the Outline tab in Pane 1 is activated and it has input focus.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.manvirsingh.net/index.php/paste-as-link-of-excel-chart-may-fail-in-powerpoint/feed/</wfw:commentRss>
		<slash:comments>5</slash:comments>
		</item>
		<item>
		<title>An MFC based ActiveX may crash Excel 2003 when inserted while recording a macro</title>
		<link>http://www.manvirsingh.net/index.php/an-mfc-based-activex-may-crash-excel-2003-when-inserted-while-recording-a-macro/</link>
		<comments>http://www.manvirsingh.net/index.php/an-mfc-based-activex-may-crash-excel-2003-when-inserted-while-recording-a-macro/#comments</comments>
		<pubDate>Sun, 31 May 2009 01:19:25 +0000</pubDate>
		<dc:creator>Manvir</dc:creator>
				<category><![CDATA[Office Automation]]></category>
		<category><![CDATA[activex]]></category>
		<category><![CDATA[crash]]></category>
		<category><![CDATA[excel]]></category>
		<category><![CDATA[visual studio]]></category>

		<guid isPermaLink="false">http://www.manvirsingh.net/?p=10</guid>
		<description><![CDATA[Let’s say we have created an ActiveX control using the wizard in Visual Studio 2008, and have checked the “Available in Insert Object Dialog” checkbox on the last page of the wizard as shown below: As the name suggests, this setting enables the ActiveX control to be in “Insert Object” dialog box, which is available [...]]]></description>
			<content:encoded><![CDATA[<p>Let’s say we have created an ActiveX control using the wizard in Visual Studio 2008, and have checked the “Available in Insert Object Dialog” checkbox on the last page of the wizard as shown below:</p>
<p style="text-align: center;"><img class="size-full wp-image-14 aligncenter" title="MFC ActiveX Control Wizard" src="http://www.manvirsingh.net/wp-content/uploads/2009/05/mfcwizard.jpg" alt="MFC ActiveX Control Wizard" width="614" height="523" /></p>
<p>As the name suggests, this setting enables the ActiveX control to be in “Insert Object” dialog box, which is available in most Compound Document container applications, such as, Wordpad, Word, Excel, PowerPoint, etc.</p>
<p>Now, when we insert such an ActiveX to Excel 2003 (using this Insert Object dialog box) while we are recording a macro; Excel may crash.</p>
<p>This happens because the default MFC implementation of the ActiveX enables it to capture the focus when instantiated. So, when we insert it to Excel while recording a macro, our ActiveX gets the focus and this causes Excel to crash.</p>
<p>If our ActiveX is not a compound document object (like Word document, PowerPoint spreadsheet etc.) then we can avoid this crash by modifying our ActiveX code generated by the MFC wizard. Here are the steps to achieve this:</p>
<ol>
<li>Open the <em>ActiveX</em>Ctrl.cpp file (here <em>ActiveX</em> is the name that you have given to your control).</li>
<li>Scroll down to the following comment and code block:</li>
<p style="text-align: left; padding-left: 60px;"><code>// Control type information<br />
</code></p>
<p style="text-align: left; padding-left: 60px;"><code>static const DWORD BASED_CODE _dwAxTest1OleMisc =<br />
OLEMISC_ACTIVATEWHENVISIBLE |<br />
OLEMISC_SETCLIENTSITEFIRST |<br />
OLEMISC_INSIDEOUT |<br />
OLEMISC_CANTLINKINSIDE |<br />
OLEMISC_RECOMPOSEONRESIZE;</code></p>
<p style="text-align: left; padding-left: 60px;"><code><br />
</code></p>
<li>Now OR a new flag <strong>OLEMISC_NOUIACTIVATE</strong> to the above list, as below:</li>
<p style="padding-left: 60px;"><code>// Control type information</code></p>
<p style="padding-left: 60px;"><code>static const DWORD BASED_CODE _dwAxTest1OleMisc =<br />
OLEMISC_ACTIVATEWHENVISIBLE |<br />
OLEMISC_SETCLIENTSITEFIRST |<br />
OLEMISC_INSIDEOUT |<br />
OLEMISC_CANTLINKINSIDE |<br />
OLEMISC_RECOMPOSEONRESIZE |<br />
<span style="color: #ff0000;"><strong>OLEMISC_NOUIACTIVATE</strong></span>;</code></p>
<p style="padding-left: 60px;"><code><br />
</code></ol>
<p>This flag ensures that our ActiveX will not get activated (or gain focus) when it is instantiated, thereby avoiding the crash in Excel 2003.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.manvirsingh.net/index.php/an-mfc-based-activex-may-crash-excel-2003-when-inserted-while-recording-a-macro/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
	</channel>
</rss>
