<?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/"
	xmlns:georss="http://www.georss.org/georss" xmlns:geo="http://www.w3.org/2003/01/geo/wgs84_pos#" xmlns:media="http://search.yahoo.com/mrss/"
	>

<channel>
	<title>tech guy in midtown &#187; C#</title>
	<atom:link href="http://techguyinmidtown.com/tag/c/feed/" rel="self" type="application/rss+xml" />
	<link>http://techguyinmidtown.com</link>
	<description>the notebook of a computer scientist living in midtown manhattan</description>
	<lastBuildDate>Mon, 12 Dec 2011 06:38:42 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.com/</generator>
<cloud domain='techguyinmidtown.com' port='80' path='/?rsscloud=notify' registerProcedure='' protocol='http-post' />
<image>
		<url>http://s2.wp.com/i/buttonw-com.png</url>
		<title>tech guy in midtown &#187; C#</title>
		<link>http://techguyinmidtown.com</link>
	</image>
	<atom:link rel="search" type="application/opensearchdescription+xml" href="http://techguyinmidtown.com/osd.xml" title="tech guy in midtown" />
	<atom:link rel='hub' href='http://techguyinmidtown.com/?pushpress=hub'/>
		<item>
		<title>Programming Excel via VSTO is painful</title>
		<link>http://techguyinmidtown.com/2008/06/15/programming-excel-via-vsto-is-painful/</link>
		<comments>http://techguyinmidtown.com/2008/06/15/programming-excel-via-vsto-is-painful/#comments</comments>
		<pubDate>Sun, 15 Jun 2008 23:25:00 +0000</pubDate>
		<dc:creator>Greg</dc:creator>
				<category><![CDATA[Custom Applications]]></category>
		<category><![CDATA[C#]]></category>
		<category><![CDATA[Excel]]></category>
		<category><![CDATA[VSTO]]></category>

		<guid isPermaLink="false">http://techguyinmidtown.wordpress.com/?p=20</guid>
		<description><![CDATA[For the past week I&#8217;ve been programming a collection of Excel worksheets in C# .NET using VSTO. Put simply, the Excel sheet needs to pull data from a database into some spreadsheets, where the user will play with it and sometimes write new data back out to the database. Excel was selected simply because that&#8217;s [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=techguyinmidtown.com&amp;blog=3566010&amp;post=20&amp;subd=techguyinmidtown&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>For the past week I&#8217;ve been programming a collection of Excel worksheets in C# .NET using VSTO.  Put simply, the Excel sheet needs to pull data from a database into some spreadsheets, where the user will play with it and sometimes write new data back out to the database.  Excel was selected simply because that&#8217;s what was requested.</p>
<p>I&#8217;ve never programmed an Excel application before, so the past week has been a learning experience. Unfortunately, pain has outweighed pleasure.</p>
<p>First, the documentation is abysmal.  Each feature spawns a peck and hunt through a maze of MSDN pages.  The functions have cryptic arguments.  Examples are rare.  Each page has supports user comments, but I&#8217;ve yet to see a single user comment on any of the MSDN pages.</p>
<p>Second, the C# code that you do manage to hammer out shares no resemblance to the plain Excel functions that you often are trying to replicate.  I&#8217;ve often found myself building up cell references and ranges, and all the references are rigid (like if somebody were to insert a row or column, it would all fall apart).</p>
<p>This week I wasted time trying to use a ListObject (a table that supports column filters and sorts).  The ListObject is seductive because you can bind it to a data source and institute rules such as read-only columns, typed columns, and primary keys.  Unfortunately the ListObject falls short in some critical ways &#8212; most critically with formulas.  Formulas for databound ListObjects seem to be unsupported, and even if you don&#8217;t bind the ListObject to data, every cell within a column is forced to contain the same formula.</p>
<p>I do think Microsoft has created a good thing with VSTO.  Programming Excel from C# feels more robust than hacking some Visual Basic together (which, in fairness, I&#8217;ve never attempted).  Visual Studio is a joy to use, and I&#8217;ve always said that Excel is the greatest programming application ever created (because of all the novice users who can do powerful, custom things with it).</p>
<p>I wish Microsoft would do two things:</p>
<ol>
<li>Improve the documentation.</li>
<li>Add a declarative programming method for specifying ranges and relative cells.  I&#8217;d like a way to say &#8220;okay, this cell contains a function that references the cell two to its left, and then I want to copy that all the way down.&#8221;  You can partly accomplish that by working within the xls sheet, but once you bounce into C#, it becomes difficult.</li>
</ol>
<br /><img alt="" border="0" src="http://feeds.wordpress.com/1.0/categories/techguyinmidtown.wordpress.com/20/" /> <img alt="" border="0" src="http://feeds.wordpress.com/1.0/tags/techguyinmidtown.wordpress.com/20/" /> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/techguyinmidtown.wordpress.com/20/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/techguyinmidtown.wordpress.com/20/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/techguyinmidtown.wordpress.com/20/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/techguyinmidtown.wordpress.com/20/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/techguyinmidtown.wordpress.com/20/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/techguyinmidtown.wordpress.com/20/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/techguyinmidtown.wordpress.com/20/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/techguyinmidtown.wordpress.com/20/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/techguyinmidtown.wordpress.com/20/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/techguyinmidtown.wordpress.com/20/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/techguyinmidtown.wordpress.com/20/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/techguyinmidtown.wordpress.com/20/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/techguyinmidtown.wordpress.com/20/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/techguyinmidtown.wordpress.com/20/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=techguyinmidtown.com&amp;blog=3566010&amp;post=20&amp;subd=techguyinmidtown&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://techguyinmidtown.com/2008/06/15/programming-excel-via-vsto-is-painful/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/92ebb01dce9310ed1f6898975c14ea23?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">Greg</media:title>
		</media:content>
	</item>
	</channel>
</rss>
