<?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:rssdatehelper="urn:rssdatehelper"><channel><title>Articles</title><link>http://lateral8.com</link><pubDate></pubDate><generator>umbraco</generator><description>Learning and living in the world of development.</description><language>en</language><item><title>Windows Media Center: Fixing “Unknown Artist” Issues</title><link>http://lateral8.com/articles/2010/6/21/windows-media-center-fixing-“unknown-artist”-issues.aspx</link><pubDate>Mon, 21 Jun 2010 07:57:41 GMT</pubDate><guid>http://lateral8.com/articles/2010/6/21/windows-media-center-fixing-“unknown-artist”-issues.aspx</guid><content:encoded><![CDATA[ 
<p>I have been an adamant user of Windows Media Center for a couple
of years now. It started completely unintentionally, I purchased a
Dell XPS 400 system that had Windows XP Media Center Edition
preinstalled. Once I dug into the features, I was instantly hooked.
When you combine Media Center with a TV tuner card and Media Center
Extender devices like the XBox 360 you have a complete solution for
distributing DVR, music, photos, and movies to any television in
your home.</p>

<p>Currently I am using Windows 7 as my hub machine, and I have two
Media Center Extenders: an XBox 360 in one room and a Linksys
DMA2200 in the other. For the most part, this setup works
flawlessly.</p>

<p>Lately, however I have been noticing some issues with the Music
Library on both of the Media Center Extenders. A large number of
newly added music tracks appear under the artist name "Unknown
Artist", even though the tracks are all tagged properly and show up
correctly in both <a
title="click here to go to the Songbird home page"
href="http://www.getsongbird.com/" target="_blank">Songbird (my
media player of choice)</a> and on the Media Center interface of
the main computer.</p>

<p>At this point I should also mention that my main source of
purchasing music lately has been the <a
title="click here to go to the Amazon MP3 store"
href="http://www.amazon.com/MP3-Music-Download/b/ref=sa_menu_dmusic2?ie=UTF8&amp;node=163856011"
 target="_blank">Amazon MP3 store</a>. It's comparable to iTunes in
the selection and pricing, but the main advantage are the DRM-free
tracks.</p>

<p>Initially, I thought maybe a corrupt music library was the
problem, so I tried to wipe out and completely rebuild the
libraries for both extenders. Unfortunately, this did nothing to
solve the problem.</p>

<p>I started looking through different posts online and also
looking at some of the tracks that were having issues on my
computer. One thing that stood out was that the track detail was
not showing up in Windows Explorer (the first copy of track 5 on
the list):</p>

<p><img
style="border-bottom: 0px; border-left: 0px; display: inline; border-top: 0px; border-right: 0px"
 title="image" border="0" alt="image"
src="/media/1712/WindowsLiveWriter_WindowsMediaCenterFixingUnknownArtistIss_6F78_image_9.png"
 width="644" height="384" />&nbsp;</p>

<p>&nbsp;</p>

<p>I tried to edit the track detail from explorer and received the
message "Error 0x8007000D: The data is invalid.":</p>

<p><img
style="border-bottom: 0px; border-left: 0px; display: inline; border-top: 0px; border-right: 0px"
 title="image" border="0" alt="image"
src="/media/1717/WindowsLiveWriter_WindowsMediaCenterFixingUnknownArtistIss_6F78_image_5.png"
 width="452" height="342" /></p>

<p>As it turns out, Windows 7 (and Vista) do not support ID3 v2.4
standard, they support ID3 v2.3. So the cause of my problem was two
sources: First, on some occasions when I was making metadata
changes in Songbird, the ID3 tag was being updated to the 2.4
version. Second, it appears that the Amazon mp3 store also uses ID3
v2.4 tag, so everything that I purchased was not being added
correctly.</p>

<p>Fortunately, identifying the problem was much more difficult
than fixing it. The easiest solution is <a
title="click here to go to the MP3Tag home page (external link)"
href="http://www.mp3tag.de/en/index.html" target="_blank">a piece
of software called MP3Tag</a>. This is a free download, but if it
solves your problems like it has solved mine then you should
consider <a title="click here to go to the MP3Tag donation page"
href="http://www.mp3tag.de/en/donations.html"
target="_blank">making a donation to the developers</a> to thank
them for their work.</p>

<p>Once you have MP3Tag installed, open the program. From the
<strong>Tools</strong> menu, select <strong>Options</strong>. On
the left side of the Options page, select Mpeg under the tags
section and verify that <strong>ID3v2</strong> is checked, and that
the radio button labeled <strong>ID3v2.3 UTF-16</strong> is the
selected option:</p>

<p><img
style="border-bottom: 0px; border-left: 0px; display: inline; border-top: 0px; border-right: 0px"
 title="image" border="0" alt="image"
src="/media/1722/WindowsLiveWriter_WindowsMediaCenterFixingUnknownArtistIss_6F78_image_8.png"
 width="554" height="466" /></p>

<p>Click <strong>OK</strong> to save your changes.</p>

<p>Now, select <strong>Change Directory</strong> from the
<strong>File</strong> menu in MP3Tag. Navigate to any folder on
your computer that contains problematic tracks. Make any tag
changes you need by using the fields on the left, and then click
Save on the toolbar to update the tag information. You can make
changes to an entire set of files by highlighting them all an
entering in the shared information. After you have saved your
changes, the tracks should now appear correctly in Windows Explorer
and in your Media Center extenders.</p>

<p>Overall, I spent about an hour re-tagging invalid tracks, but
now that I know the cause it should be relatively easy to check new
music as I purchase it. I hope this helps others as well!</p>
]]></content:encoded></item><item><title>Android Applications: My Tracks</title><link>http://lateral8.com/articles/2010/6/20/android-applications-my-tracks.aspx</link><pubDate>Sun, 20 Jun 2010 16:20:13 GMT</pubDate><guid>http://lateral8.com/articles/2010/6/20/android-applications-my-tracks.aspx</guid><content:encoded><![CDATA[ 
<p>Let me begin with the end, and show you my most recent mountain
bike ride, courtesy of Google Maps:</p>

<p>&nbsp;</p>

<?UMBRACO_MACRO
googlemapslink="http://maps.google.com/maps/ms?ie=UTF8&amp;hl=en&amp;msa=0&amp;msid=108620161239782544894.00048964fb1b8fb874cd9&amp;ll=35.269589,-81.006789&amp;spn=0.025718,0.038581&amp;t=h&amp;z=15"
width="425" macroAlias="GoogleMap" height="350" /> 

<p><br />
 View <a style="text-align: left; color: #0000ff"
href="http://maps.google.com/maps/ms?ie=UTF8&amp;hl=en&amp;msa=0&amp;msid=108620161239782544894.00048964fb1b8fb874cd9&amp;t=h&amp;ll=35.268814,-81.006786&amp;spn=0.018985,0.012258&amp;source=embed">
Usnwc 6/19</a> in a larger map</p>

<p>&nbsp;</p>

<p>From looking at the above map, it would appear that I stopped
and checked my stats pretty frequently. I can't imagine a bike ride
where that would be considered fun. Fortunately, thanks to my
Android phone and Google's <a href="http://mytracks.appspot.com/"
target="_blank"
title="click here to view the My Tracks web site">My Tracks
application</a>, this isn't the case.</p>

<p>For starters, you will obviously need an Android device that is
GPS capable, and also the My Tracks application itself. If you are
on your Android phone right now and have access to the market, <a
href="http://market.android.com/search?q=pname:com.google.android.maps.mytracks"
 target="_blank"
title="click here to go directly to the market from your Android device">
click here to go directly to the download</a>.</p>

<p>You can also scan the code below with your phone if you have
Barcode Scanner installed:</p>

<p><img src="http://mytracks.appspot.com/images/qr_big.png" border="0" style="border-width: 0px;"/></p>

<p>Once you have my tracks installed and you are ready to
ride/walk/track, open the My Tracks application. Depending on the
activity, you may want to change a few settings. To do so, press
Menu and then tap Settings.</p>

<p>&nbsp;</p>

<p>In my case, I found that the default tracking settings didn't
work well for tight trails with lots of switchbacks, so here are
the settings I am currently using:</p>

<table border="1" cellspacing="0" cellpadding="2"
style="width: 400px;">
<thead>
<tr style="background: #000000; color: #ffffff; font-weight: bold">
<td width="200" valign="top">Description</td>
<td width="200" valign="top">Setting</td>
</tr>
</thead>

<tbody>
<tr>
<td width="200" valign="top">Use Metric Units</td>
<td width="200" valign="top">Unchecked</td>
</tr>

<tr>
<td width="200" valign="top">Display Speed</td>
<td width="200" valign="top">Checked</td>
</tr>

<tr>
<td width="200" valign="top">Announcement Frequency</td>
<td width="200" valign="top">15 minutes</td>
</tr>

<tr>
<td width="200" valign="top">Split Frequency</td>
<td width="200" valign="top">1 mile</td>
</tr>

<tr>
<td width="200" valign="top">Min time between points</td>
<td width="200" valign="top">Highest</td>
</tr>

<tr>
<td width="200" valign="top">Min distance between points</td>
<td width="200" valign="top">6 feet</td>
</tr>

<tr>
<td width="200" valign="top">Max distance between points</td>
<td width="200" valign="top">328 feet</td>
</tr>

<tr>
<td width="200" valign="top">Minimum accuracy</td>
<td width="200" valign="top">328 feet</td>
</tr>

<tr>
<td width="200" valign="top">Signal sampling frequency</td>
<td width="200" valign="top">Off</td>
</tr>

<tr>
<td width="200" valign="top"></td>
<td width="200" valign="top"></td>
</tr>
</tbody>
</table>

<p>Assuming you have no changes to make, you can now start
recording your track by pressing <strong>Menu</strong> and tapping
<strong>Record Track</strong>. Now for the hard part. ride, walk or
run!</p>

<p>It's important to note that GPS can take a lot of life from your
battery quickly. Make sure you start your rides with 100% battery
life so that you don't run out of juice. you definitely want to be
able to call for help if you need it! I personally wouldn't do this
at all for remote or extended rides. I only use it for local trails
to help keep track of my trail times and average moving speed.</p>

<p>My favorite part of using My Tracks is the announcements. When
this is enabled, you will get audio reports every so often telling
you your total distance and average speed. this is a huge motivator
for me, it's like being able to race yourself every time you
ride.</p>

<p>The next best part of My Tracks are the splits. If you click on
any of the yellow pins in the map above, you will notice that
statistics are inserted at each interval. In addition to distance
and average speed, you can also view elevation, grade, and maximum
speed for each split.</p>

<p>Once you have completed a ride, you end the track by pressing
<strong>Menu</strong> and then tapping <strong>Stop
Recording</strong>. You will be prompted to enter details about the
track:</p>

<p><img src="/media/1649/WindowsLiveWriter_AndroidApplicationsMyTracks_C8FD_CAP201006201551_3.jpg" width="237" height="354" alt="Enter the track details (screenshot)" border="0" style="border-bottom: 0px; border-left: 0px; display: inline; border-top: 0px; border-right: 0px"/></p>

<p>At this point you can just keep the saved the track on your
phone, or you can send the track to My Maps on Google.</p>

<p>You can also review all of the information about the current
track on your phone. Tap either of the onscreen arrows (left or
right) to switch between map, statistics, and elevation views:</p>

<div style="text-align: center">
<table border="1" cellspacing="0" cellpadding="2" align="center"
style="width: 600px;">
<tbody>
<tr>
<td width="200" valign="top"><a
href="/media/1654/WindowsLiveWriter_AndroidApplicationsMyTracks_C8FD_CAP2010062016071_2.jpg">
<img src="/media/1659/WindowsLiveWriter_AndroidApplicationsMyTracks_C8FD_CAP2010062016071_thumb.jpg" width="164" height="244" alt="CAP2010062016071" border="0" style="border-bottom: 0px; border-left: 0px; display: inline; border-top: 0px; border-right: 0px"/></a></td>
<td width="200" valign="top"><a
href="/media/1664/WindowsLiveWriter_AndroidApplicationsMyTracks_C8FD_CAP2010062016081_2.jpg">
<img src="/media/1669/WindowsLiveWriter_AndroidApplicationsMyTracks_C8FD_CAP2010062016081_thumb.jpg" width="164" height="244" alt="CAP2010062016081" border="0" style="border-bottom: 0px; border-left: 0px; display: inline; border-top: 0px; border-right: 0px"/></a></td>
<td width="200" valign="top"><a
href="/media/1674/WindowsLiveWriter_AndroidApplicationsMyTracks_C8FD_CAP201006201608_4.jpg">
<img src="/media/1679/WindowsLiveWriter_AndroidApplicationsMyTracks_C8FD_CAP201006201608_thumb_1.jpg" width="164" height="244" alt="CAP201006201608" border="0" style="border-bottom: 0px; border-left: 0px; display: inline; border-top: 0px; border-right: 0px"/></a></td>
</tr>

<tr>
<td width="200" valign="top"><em>Map View</em></td>
<td width="200" valign="top"><em>Statistics View</em></td>
<td width="200" valign="top"><em>Elevation and Speed View (speed is
blue, elevation is green)</em></td>
</tr>
</tbody>
</table>
</div>

<p>&nbsp;</p>

<p>There is also a <a
href="http://www.googlelabs.com/show_details?app_key=agtnbGFiczIwLXd3d3IUCxIMTGFic0FwcE1vZGVsGJLhEQw"
 target="_blank"
title="click here to open the main site for the My Maps Editor">My
Maps Editor</a> application for Android, where you can edit the
map. Editing features include the ability to add new markers and/or
change the map's title and description.</p>

<p>Once you choose to upload your map, you can also share it via
several options, including Gmail, Twitter, Facebook, and also in
GPX or KML formats.</p>

<p>This is an excellent application for any outdoor activity and
has a wide variety of uses, from trail marking to personal fitness
tracking. Be sure to check it out if you spend any time
outdoors!</p>
]]></content:encoded></item><item><title>OpenXML SDK 2.0: Formatting Excel Values</title><link>http://lateral8.com/articles/2010/6/11/openxml-sdk-20-formatting-excel-values.aspx</link><pubDate>Fri, 11 Jun 2010 15:23:05 GMT</pubDate><guid>http://lateral8.com/articles/2010/6/11/openxml-sdk-20-formatting-excel-values.aspx</guid><content:encoded><![CDATA[ 
<p>This is a follow-up article to my previous post, <a
title="click here to view the original article"
href="/articles/2010/3/5/openxml-sdk-20-export-a-datatable-to-excel.aspx">
OpenXML SDK 2.0: Export a DataTable to Excel</a>. In that post, I
demonstrated how to install and use the <a
href="http://en.wikipedia.org/wiki/Office_Open_XML"
target="_blank">OpenXML</a> SDK, and also provided sample code for
exporting a DataTable to Microsoft Excel 2007. I highly recommend
starting with the previous post if you are not familiar with the
SDK.</p>

<p>This article builds on the original code and demonstrates how to
apply style and value formatting to the cells inside the
workbook.</p>

<p>To enable value and text formatting for the resulting workbook,
I have created new helper methods.</p>

<h3>Setting Colors and Styles</h3>

<p>This first method will create a new Font object and add it to
the stylesheet collection within the workbook:</p>

<blockquote>
<div
style="background: #fff; border: #000080 1px solid; color: #000; display: inline; float: none; font-family: 'Courier New', Courier, Monospace; font-size: 10pt; margin: 0px; max-height: 300px; overflow: auto; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px"
 id="scid:9ce6104f-a9aa-4a17-a79f-3a39532ebf7c:891087d7-0e4e-4599-9ac6-b939cf4455b6"
 class="wlWriterEditableSmartContent">
<ol
style="background: #ffffff; margin: 0; padding: 0 0 0 5px; white-space: nowrap">
<li><span style="color:#0000ff">private</span> <span
style="color:#2b91af">UInt32Value</span> createFont(</li>

<li style="background: #f3f3f3">
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span
 style="color:#2b91af">Stylesheet</span> styleSheet,</li>

<li>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span
 style="color:#0000ff">string</span> fontName,</li>

<li style="background: #f3f3f3">
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span
 style="color:#2b91af">Nullable</span>&lt;<span
style="color:#0000ff">double</span>&gt; fontSize,</li>

<li>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span
 style="color:#0000ff">bool</span> isBold,</li>

<li style="background: #f3f3f3">
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;System.Drawing.<span
 style="color:#2b91af">Color</span> foreColor)</li>

<li>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;{</li>

<li style="background: #f3f3f3">&nbsp;</li>

<li>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span
 style="color:#2b91af">Font</span> font = <span
style="color:#0000ff">new</span> <span
style="color:#2b91af">Font</span>();</li>

<li style="background: #f3f3f3">
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</li>

<li>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span
 style="color:#0000ff">if</span> (!<span
style="color:#0000ff">string</span>.IsNullOrEmpty(fontName))</li>

<li style="background: #f3f3f3">
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;{</li>

<li>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span
 style="color:#2b91af">FontName</span> name = <span
style="color:#0000ff">new</span> <span
style="color:#2b91af">FontName</span>()</li>

<li style="background: #f3f3f3">
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;{</li>

<li>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Val
= fontName</li>

<li style="background: #f3f3f3">
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;};</li>

<li>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;font.Append(name);</li>

<li style="background: #f3f3f3">
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}</li>

<li>&nbsp;</li>

<li style="background: #f3f3f3">
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span
 style="color:#0000ff">if</span> (fontSize.HasValue)</li>

<li>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;{</li>

<li style="background: #f3f3f3">
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span
 style="color:#2b91af">FontSize</span> size = <span
style="color:#0000ff">new</span> <span
style="color:#2b91af">FontSize</span>()</li>

<li>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;{</li>

<li style="background: #f3f3f3">
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Val
= fontSize.Value</li>

<li>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;};</li>

<li style="background: #f3f3f3">
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;font.Append(size);</li>

<li>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}</li>

<li style="background: #f3f3f3">&nbsp;</li>

<li>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span
 style="color:#0000ff">if</span> (isBold == <span
style="color:#0000ff">true</span>)</li>

<li style="background: #f3f3f3">
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;{</li>

<li>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span
 style="color:#2b91af">Bold</span> bold = <span
style="color:#0000ff">new</span> <span
style="color:#2b91af">Bold</span>();</li>

<li style="background: #f3f3f3">
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;font.Append(bold);</li>

<li>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}</li>

<li style="background: #f3f3f3">&nbsp;</li>

<li>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span
 style="color:#0000ff">if</span> (foreColor != <span
style="color:#0000ff">null</span>)</li>

<li style="background: #f3f3f3">
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;{</li>

<li>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span
 style="color:#2b91af">Color</span> color = <span
style="color:#0000ff">new</span> <span
style="color:#2b91af">Color</span>()</li>

<li style="background: #f3f3f3">
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;{</li>

<li>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Rgb
= <span style="color:#0000ff">new</span> <span
style="color:#2b91af">HexBinaryValue</span>()</li>

<li style="background: #f3f3f3">
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;{</li>

<li>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Value
=</li>

<li style="background: #f3f3f3">
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;System.Drawing.<span
 style="color:#2b91af">ColorTranslator</span>.ToHtml(</li>

<li>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;System.Drawing.<span
 style="color:#2b91af">Color</span>.FromArgb(</li>

<li style="background: #f3f3f3">
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;foreColor.A,</li>

<li>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;foreColor.R,</li>

<li style="background: #f3f3f3">
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;foreColor.G,</li>

<li>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;foreColor.B)).Replace(<span
 style="color:#a31515">"#"</span>, <span
style="color:#a31515">""</span>)</li>

<li style="background: #f3f3f3">
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}</li>

<li>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;};</li>

<li style="background: #f3f3f3">
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;font.Append(color);</li>

<li>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}</li>

<li style="background: #f3f3f3">
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;styleSheet.Fonts.Append(font);</li>

<li>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span
 style="color:#2b91af">UInt32Value</span> result =
styleSheet.Fonts.Count;</li>

<li style="background: #f3f3f3">
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;styleSheet.Fonts.Count++;</li>

<li>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span
 style="color:#0000ff">return</span> result;</li>

<li style="background: #f3f3f3">
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}</li>
</ol>
</div>

<p>The return value of the method above is the index number of the
newly added Font object.</p>

<p>Next is the createFill method. This method works exactly like
the createFont method and also returns a new index value after the
Fill has been added to the workbook's styles collection:</p>

<div
style="background: #fff; border: #000080 1px solid; color: #000; display: inline; float: none; font-family: 'Courier New', Courier, Monospace; font-size: 10pt; margin: 0px; max-height: 300px; overflow: auto; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px"
 id="scid:9ce6104f-a9aa-4a17-a79f-3a39532ebf7c:8951dc9b-d0e3-4f7f-87e7-89330dc27fe6"
 class="wlWriterEditableSmartContent">
<ol
style="background: #ffffff; margin: 0; padding: 0 0 0 5px; white-space: nowrap">
<li><span style="color:#0000ff">private</span> <span
style="color:#2b91af">UInt32Value</span> createFill(</li>

<li style="background: #f3f3f3">&nbsp;&nbsp;&nbsp;&nbsp;<span
style="color:#2b91af">Stylesheet</span> styleSheet,</li>

<li>&nbsp;&nbsp;&nbsp;&nbsp;System.Drawing.<span
style="color:#2b91af">Color</span> fillColor)</li>

<li style="background: #f3f3f3">{</li>

<li>&nbsp;&nbsp;&nbsp;&nbsp;<span style="color:#2b91af">Fill</span>
fill = <span style="color:#0000ff">new</span> <span
style="color:#2b91af">Fill</span>(</li>

<li style="background: #f3f3f3">
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span
style="color:#0000ff">new</span> <span
style="color:#2b91af">PatternFill</span>(</li>

<li>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span
 style="color:#0000ff">new</span> <span
style="color:#2b91af">ForegroundColor</span>()</li>

<li style="background: #f3f3f3">
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;{</li>

<li>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Rgb
= <span style="color:#0000ff">new</span> <span
style="color:#2b91af">HexBinaryValue</span>()</li>

<li style="background: #f3f3f3">
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;{</li>

<li>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Value
=</li>

<li style="background: #f3f3f3">
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;System.Drawing.<span
 style="color:#2b91af">ColorTranslator</span>.ToHtml(</li>

<li>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;System.Drawing.<span
 style="color:#2b91af">Color</span>.FromArgb(</li>

<li style="background: #f3f3f3">
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;fillColor.A,</li>

<li>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;fillColor.R,</li>

<li style="background: #f3f3f3">
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;fillColor.G,</li>

<li>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;fillColor.B)).Replace(<span
 style="color:#a31515">"#"</span>, <span
style="color:#a31515">""</span>)</li>

<li style="background: #f3f3f3">
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}</li>

<li>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;})</li>

<li style="background: #f3f3f3">
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;{</li>

<li>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;PatternType
= <span style="color:#2b91af">PatternValues</span>.Solid</li>

<li style="background: #f3f3f3">
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}</li>

<li>&nbsp;&nbsp;&nbsp;&nbsp;);</li>

<li style="background: #f3f3f3">
&nbsp;&nbsp;&nbsp;&nbsp;styleSheet.Fills.Append(fill);</li>

<li>&nbsp;</li>

<li style="background: #f3f3f3">&nbsp;&nbsp;&nbsp;&nbsp;<span
style="color:#2b91af">UInt32Value</span> result =
styleSheet.Fills.Count;</li>

<li>&nbsp;&nbsp;&nbsp;&nbsp;styleSheet.Fills.Count++;</li>

<li style="background: #f3f3f3">&nbsp;&nbsp;&nbsp;&nbsp;<span
style="color:#0000ff">return</span> result;</li>

<li>}</li>
</ol>
</div>

<p>&nbsp;</p>

<p>Finally, once you have created a Font and/or Fill, you need to
create a CellFormat object and add it to your styles
collection:</p>

<div
style="background: #fff; border: #000080 1px solid; color: #000; display: inline; float: none; font-family: 'Courier New', Courier, Monospace; font-size: 10pt; margin: 0px; max-height: 300px; overflow: auto; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px"
 id="scid:9ce6104f-a9aa-4a17-a79f-3a39532ebf7c:1f19cb02-8b55-4af3-82a9-b182ecf66227"
 class="wlWriterEditableSmartContent">
<ol
style="background: #ffffff; margin: 0; padding: 0 0 0 5px; white-space: nowrap">
<li><span style="color:#0000ff">private</span> <span
style="color:#2b91af">UInt32Value</span> createCellFormat(</li>

<li style="background: #f3f3f3">&nbsp;&nbsp;&nbsp;&nbsp;<span
style="color:#2b91af">Stylesheet</span> styleSheet,</li>

<li>&nbsp;&nbsp;&nbsp;&nbsp;<span
style="color:#2b91af">UInt32Value</span> fontIndex,</li>

<li style="background: #f3f3f3">&nbsp;&nbsp;&nbsp;&nbsp;<span
style="color:#2b91af">UInt32Value</span> fillIndex,</li>

<li>&nbsp;&nbsp;&nbsp;&nbsp;<span
style="color:#2b91af">UInt32Value</span> numberFormatId)</li>

<li style="background: #f3f3f3">{</li>

<li>&nbsp;&nbsp;&nbsp;&nbsp;<span
style="color:#2b91af">CellFormat</span> cellFormat = <span
style="color:#0000ff">new</span> <span
style="color:#2b91af">CellFormat</span>();</li>

<li style="background: #f3f3f3">&nbsp;&nbsp;&nbsp;&nbsp;</li>

<li>&nbsp;&nbsp;&nbsp;&nbsp;<span style="color:#0000ff">if</span>
(fontIndex != <span style="color:#0000ff">null</span>)</li>

<li style="background: #f3f3f3">
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;cellFormat.FontId =
fontIndex;</li>

<li>&nbsp;&nbsp;&nbsp;&nbsp;</li>

<li style="background: #f3f3f3">&nbsp;&nbsp;&nbsp;&nbsp;<span
style="color:#0000ff">if</span> (fillIndex != <span
style="color:#0000ff">null</span>)</li>

<li>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;cellFormat.FillId =
fillIndex;</li>

<li style="background: #f3f3f3">&nbsp;</li>

<li>&nbsp;&nbsp;&nbsp;&nbsp;<span style="color:#0000ff">if</span>
(numberFormatId != <span style="color:#0000ff">null</span>)</li>

<li style="background: #f3f3f3">&nbsp;&nbsp;&nbsp;&nbsp;{</li>

<li>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;cellFormat.NumberFormatId
= numberFormatId;</li>

<li style="background: #f3f3f3">
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;cellFormat.ApplyNumberFormat
= <span style="color:#2b91af">BooleanValue</span>.FromBoolean(<span
style="color:#0000ff">true</span>);</li>

<li>&nbsp;&nbsp;&nbsp;&nbsp;}</li>

<li style="background: #f3f3f3">&nbsp;</li>

<li>
&nbsp;&nbsp;&nbsp;&nbsp;styleSheet.CellFormats.Append(cellFormat);</li>

<li style="background: #f3f3f3">&nbsp;</li>

<li>&nbsp;&nbsp;&nbsp;&nbsp;<span
style="color:#2b91af">UInt32Value</span> result =
styleSheet.CellFormats.Count;</li>

<li style="background: #f3f3f3">
&nbsp;&nbsp;&nbsp;&nbsp;styleSheet.CellFormats.Count++;</li>

<li>&nbsp;&nbsp;&nbsp;&nbsp;<span
style="color:#0000ff">return</span> result;</li>

<li style="background: #f3f3f3">}</li>
</ol>
</div>

<p>&nbsp;</p>

<p>Once you have created your CellFormat objects, you can apply
them to any cell value by setting the StyleIndex property for the
Cell object. This code demonstrates using all of the methods above
to create a header format for the first row of the resulting
workbook:</p>
</blockquote>

<div
style="background: #fff; border: #000080 1px solid; color: #000; display: inline; float: none; font-family: 'Courier New', Courier, Monospace; font-size: 10pt; margin: 0px; max-height: 300px; overflow: auto; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px"
 id="scid:9ce6104f-a9aa-4a17-a79f-3a39532ebf7c:1963b352-d664-4583-ae08-7f00ee7894cd"
 class="wlWriterEditableSmartContent">
<ol
style="background: #ffffff; margin: 0; padding: 0 0 0 5px; white-space: nowrap">
<li><span style="color:#008000">//add column names to the first
row</span></li>

<li style="background: #f3f3f3">
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span
 style="color:#2b91af">Row</span> header = <span
style="color:#0000ff">new</span> <span
style="color:#2b91af">Row</span>();</li>

<li>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;header.RowIndex
= (<span style="color:#2b91af">UInt32</span>)1;</li>

<li style="background: #f3f3f3">&nbsp;</li>

<li>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span
 style="color:#2b91af">Stylesheet</span> styleSheet =
workbook.WorkbookStylesPart.Stylesheet;</li>

<li style="background: #f3f3f3">&nbsp;</li>

<li>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span
 style="color:#008000">//build the formatted header
style</span></li>

<li style="background: #f3f3f3">
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span
 style="color:#2b91af">UInt32Value</span> headerFontIndex =</li>

<li>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;createFont(</li>

<li style="background: #f3f3f3">
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;styleSheet,</li>

<li>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span
 style="color:#a31515">"Arial"</span>,</li>

<li style="background: #f3f3f3">
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;12,</li>

<li>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span
 style="color:#0000ff">true</span>,</li>

<li style="background: #f3f3f3">
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;System.Drawing.<span
 style="color:#2b91af">Color</span>.White);</li>

<li>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span
 style="color:#008000">//set the background color style</span></li>

<li style="background: #f3f3f3">
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span
 style="color:#2b91af">UInt32Value</span> headerFillIndex =</li>

<li>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;createFill(</li>

<li style="background: #f3f3f3">
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;styleSheet,</li>

<li>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;System.Drawing.<span
 style="color:#2b91af">Color</span>.SlateGray);</li>

<li style="background: #f3f3f3">
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span
 style="color:#008000">//create the cell style by combining
font/background</span></li>

<li>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span
 style="color:#2b91af">UInt32Value</span> headerStyleIndex =</li>

<li style="background: #f3f3f3">
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;createCellFormat(</li>

<li>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;styleSheet,</li>

<li style="background: #f3f3f3">
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;headerFontIndex,</li>

<li>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;headerFillIndex,</li>

<li style="background: #f3f3f3">
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span
 style="color:#0000ff">null</span>);</li>

<li>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</li>

<li style="background: #f3f3f3">
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span
 style="color:#0000ff">foreach</span> (<span
style="color:#2b91af">DataColumn</span> column <span
style="color:#0000ff">in</span> table.Columns)</li>

<li>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;{</li>

<li style="background: #f3f3f3">
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span
 style="color:#2b91af">Cell</span> headerCell =
createTextCell(</li>

<li>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;table.Columns.IndexOf(column)
+ 1,</li>

<li style="background: #f3f3f3">
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;1,</li>

<li>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;column.ColumnName,</li>

<li style="background: #f3f3f3">
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;headerStyleIndex);</li>

<li>&nbsp;</li>

<li style="background: #f3f3f3">
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;header.AppendChild(headerCell);</li>

<li>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}</li>

<li style="background: #f3f3f3">
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;data.AppendChild(header);</li>
</ol>
</div>

<p>The final piece of the solution is to add the styleIndex
parameter to the createTextCell method and set the StyleIndex
property on the Cell:</p>

<div
style="background: #fff; border: #000080 1px solid; color: #000; display: inline; float: none; font-family: 'Courier New', Courier, Monospace; font-size: 10pt; margin: 0px; max-height: 300px; overflow: auto; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px"
 id="scid:9ce6104f-a9aa-4a17-a79f-3a39532ebf7c:1b9567ab-2b4a-477b-b508-f776e16c9791"
 class="wlWriterEditableSmartContent">
<ol
style="background: #ffffff; margin: 0; padding: 0 0 0 5px; white-space: nowrap">
<li><span style="color:#008000">//apply the cell style if
supplied</span></li>

<li style="background: #f3f3f3"><span
style="color:#0000ff">if</span> (styleIndex.HasValue)</li>

<li>&nbsp;&nbsp;&nbsp;&nbsp;cell.StyleIndex =
styleIndex.Value;</li>
</ol>
</div>

<p>&nbsp;</p>

<h3>Formatting Cell Values Correctly</h3>

<p>&nbsp;</p>

<p>The fourth parameter for the <strong>createCellFormat</strong>
method allows you to format cell values based on your data types.
Although you can create custom cell formats in the same manner that
you build the font and background color, the OpenXML specification
(detailed in the section 8.8.30 of of the <a
title="click here to view and/or download the ECMA-376 draft documents"
 href="http://www.ecma-international.org/publications/standards/Ecma-376.htm">
Standard ECMA-376 Office Open XML File Formats second edition
draft</a>) has a set of implied cell formats, meaning you can
reference them without explicitly adding them to the StyleSheet.
Here is a list of the implied formats from the draft:</p>

<div>
<table style="width: 300px" cellspacing="0" cellpadding="2">
<thead>
<tr style="background-color: #000000; color: #ffffff">
<th><strong>ID</strong> </th>
<th><strong>Format Code</strong> </th>
</tr>
</thead>

<tbody>
<tr>
<td>0</td>
<td>General</td>
</tr>

<tr>
<td>1</td>
<td>0</td>
</tr>

<tr>
<td>2</td>
<td>0.00</td>
</tr>

<tr>
<td>3</td>
<td>#,##0</td>
</tr>

<tr>
<td>4</td>
<td>#,##0.00</td>
</tr>

<tr>
<td>9</td>
<td>0%</td>
</tr>

<tr>
<td>10</td>
<td>0.00%</td>
</tr>

<tr>
<td>11</td>
<td>0.00E+00</td>
</tr>

<tr>
<td>12</td>
<td># ?/?</td>
</tr>

<tr>
<td>13</td>
<td># ??/??</td>
</tr>

<tr>
<td>14</td>
<td>mm-dd-yy</td>
</tr>

<tr>
<td>15</td>
<td>d-mmm-yy</td>
</tr>

<tr>
<td>16</td>
<td>d-mmm</td>
</tr>

<tr>
<td>17</td>
<td>mmm-yy</td>
</tr>

<tr>
<td>18</td>
<td>h:mm AM/PM</td>
</tr>

<tr>
<td>19</td>
<td>h:mm:ss AM/PM</td>
</tr>

<tr>
<td>20</td>
<td>h:mm</td>
</tr>

<tr>
<td>21</td>
<td>h:mm:ss</td>
</tr>

<tr>
<td>22</td>
<td>m/d/yy h:mm</td>
</tr>

<tr>
<td>37</td>
<td>#,##0 ;(#,##0)</td>
</tr>

<tr>
<td>38</td>
<td>#,##0 ;[Red](#,##0)</td>
</tr>

<tr>
<td>39</td>
<td>#,##0.00;(#,##0.00)</td>
</tr>

<tr>
<td>40</td>
<td>#,##0.00;[Red](#,##0.00)</td>
</tr>

<tr>
<td>45</td>
<td>mm:ss</td>
</tr>

<tr>
<td>46</td>
<td>[h]:mm:ss</td>
</tr>

<tr>
<td>47</td>
<td>mmss.0</td>
</tr>

<tr>
<td>48</td>
<td>##0.0E+0</td>
</tr>

<tr>
<td>49</td>
<td>@</td>
</tr>
</tbody>
</table>
</div>

<p>If you run the sample code provided in the first article, one
thing you will notice about the resulting Excel document is that
even cells with numeric values are treated as text. Anyone familiar
with Excel has seen this pop-up tag on many occasions:</p>

<p>&nbsp;<img
style="border-right-width: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px"
 title="image" border="0" alt="image"
src="/media/1615/WindowsLiveWriter_OpenXMLSDK2.0FormattingExcelValues_13FEF_image_3.png"
 width="187" height="240" /><br />
</p>

<p><em>Error correction in Excel highlights the values that are
stored as text.</em></p>

<p>The reason behind this was due to the way cell values were added
in the <strong>createTextCell</strong> method. Because the DataType
of the cell is set to InlineString, the content passed into the
cell was always treated as text. To overcome this limitation, I
created another new method, <strong>createValueCell.</strong>
First, I created three new basic styles using the createCellFormat
method (using the cell formats from the table above):</p>

<div
style="background-color: #ffffff; border: #000080 1px solid; color: #000; display: inline; float: none; font-family: 'Courier New', Courier, Monospace; font-size: 10pt; margin: 0px; max-height: 300px; overflow: auto; padding: 2px 5px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; white-space: nowrap"
 id="scid:9ce6104f-a9aa-4a17-a79f-3a39532ebf7c:378ebf5f-aaaf-43dc-a53e-9b4b6097c2e9"
 class="wlWriterEditableSmartContent"><span
style="color:#008000">/*</span><br />
 &nbsp;<span style="color:#008000">* Create a set of basic cell
styles for specific formats...</span><br />
 &nbsp;<span style="color:#008000">* If you are controlling your
table then you can simply create the styles you need,</span><br />
 &nbsp;<span style="color:#008000">* this set of code is still
intended to be generic.</span><br />
 &nbsp;<span style="color:#008000">*/</span><br />
 _numberStyleId = createCellFormat(styleSheet, <span
style="color:#0000ff">null</span>, <span
style="color:#0000ff">null</span>, <span
style="color:#2b91af">UInt32Value</span>.FromUInt32(3));<br />
 _doubleStyleId = createCellFormat(styleSheet, <span
style="color:#0000ff">null</span>, <span
style="color:#0000ff">null</span>, <span
style="color:#2b91af">UInt32Value</span>.FromUInt32(4));<br />
 _dateStyleId = createCellFormat(styleSheet, <span
style="color:#0000ff">null</span>, <span
style="color:#0000ff">null</span>, <span
style="color:#2b91af">UInt32Value</span>.FromUInt32(14));</div>

<p>You will notice in the code above that each "style" was created
using the same createCellFormat method; the font and fill values
have just been omitted.</p>

<p>Now while the table rows are being iterated through, we can
check the data type of each value and decide whether or not to
apply one of the formatted styles to each cell:</p>

<div
style="background: #fff; border: #000080 1px solid; color: #000; display: inline; float: none; font-family: 'Courier New', Courier, Monospace; font-size: 10pt; margin: 0px; max-height: 300px; overflow: auto; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px"
 id="scid:9ce6104f-a9aa-4a17-a79f-3a39532ebf7c:29deea03-9e2e-4eaf-b516-3a9369e7c298"
 class="wlWriterEditableSmartContent">
<ol
style="background: #ffffff; margin: 0; padding: 0 0 0 5px; white-space: nowrap">
<li><span style="color:#0000ff">private</span> <span
style="color:#2b91af">Row</span> createContentRow(</li>

<li style="background: #f3f3f3">
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span
 style="color:#2b91af">DataRow</span> dataRow,</li>

<li>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span
 style="color:#0000ff">int</span> rowIndex)</li>

<li style="background: #f3f3f3">
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;{</li>

<li>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span
 style="color:#2b91af">Row</span> row = <span
style="color:#0000ff">new</span> <span
style="color:#2b91af">Row</span></li>

<li style="background: #f3f3f3">&nbsp;</li>

<li>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;{</li>

<li style="background: #f3f3f3">
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;RowIndex
= (<span style="color:#2b91af">UInt32</span>)rowIndex</li>

<li>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;};</li>

<li style="background: #f3f3f3">
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</li>

<li>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span
 style="color:#2b91af">Nullable</span>&lt;<span
style="color:#0000ff">uint</span>&gt; styleIndex = <span
style="color:#0000ff">null</span>;</li>

<li style="background: #f3f3f3">
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span
 style="color:#0000ff">double</span> doubleValue;</li>

<li>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span
 style="color:#0000ff">int</span> intValue;</li>

<li style="background: #f3f3f3">
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span
 style="color:#2b91af">DateTime</span> dateValue;</li>

<li>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</li>

<li style="background: #f3f3f3">
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span
 style="color:#0000ff">for</span> (<span
style="color:#0000ff">int</span> i = 0; i &lt;
dataRow.Table.Columns.Count; i++)</li>

<li>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;{</li>

<li style="background: #f3f3f3">
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span
 style="color:#2b91af">Cell</span> dataCell;</li>

<li>&nbsp;</li>

<li style="background: #f3f3f3">
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span
 style="color:#008000">//check the data type of the cell content to
apply basic formatting</span></li>

<li>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span
 style="color:#0000ff">if</span> (<span
style="color:#2b91af">DateTime</span>.TryParse(dataRow[i].ToString(),
<span style="color:#0000ff">out</span> dateValue))</li>

<li style="background: #f3f3f3">
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;{</li>

<li>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;styleIndex
= _dateStyleId;</li>

<li style="background: #f3f3f3">
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span
 style="color:#008000">//the ToOADate method addresses how Excel
stores Date values...</span></li>

<li>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;dataCell
= createValueCell(i + 1, rowIndex, dateValue.ToOADate().ToString(),
styleIndex);</li>

<li style="background: #f3f3f3">
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}</li>

<li>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span
 style="color:#0000ff">else</span> <span
style="color:#0000ff">if</span> (<span
style="color:#0000ff">int</span>.TryParse(dataRow[i].ToString(),
<span style="color:#0000ff">out</span> intValue))</li>

<li style="background: #f3f3f3">
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;{</li>

<li>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;styleIndex
= _numberStyleId;</li>

<li style="background: #f3f3f3">
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;dataCell
= createValueCell(i + 1, rowIndex, intValue, styleIndex);</li>

<li>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}</li>

<li style="background: #f3f3f3">
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span
 style="color:#0000ff">else</span> <span
style="color:#0000ff">if</span> (<span
style="color:#2b91af">Double</span>.TryParse(dataRow[i].ToString(),
<span style="color:#0000ff">out</span> doubleValue))</li>

<li>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;{</li>

<li style="background: #f3f3f3">
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;styleIndex
= _doubleStyleId;</li>

<li>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;dataCell
= createValueCell(i + 1, rowIndex, doubleValue, styleIndex);</li>

<li style="background: #f3f3f3">
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}</li>

<li>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span
 style="color:#0000ff">else</span></li>

<li style="background: #f3f3f3">
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;{</li>

<li>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span
 style="color:#008000">//assume the value is string, use the
InlineString value type...</span></li>

<li style="background: #f3f3f3">
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;dataCell
= createTextCell(i + 1, rowIndex, dataRow[i], <span
style="color:#0000ff">null</span>);</li>

<li>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}</li>

<li style="background: #f3f3f3">&nbsp;</li>

<li>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</li>

<li style="background: #f3f3f3">
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;row.AppendChild(dataCell);</li>

<li>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;styleIndex
= <span
style="color:#0000ff">null</span>;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</li>

<li style="background: #f3f3f3">
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}</li>

<li>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span
 style="color:#0000ff">return</span> row;</li>

<li style="background: #f3f3f3">
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}</li>
</ol>
</div>

<p>In most cases, you will know when to apply the correct styles to
each value based on your source data. In either case, the
<strong>createValueCell</strong> method will store the cell content
correctly, and also allow you to format those values as needed:</p>

<div
style="background: #fff; border: #000080 1px solid; color: #000; display: inline; float: none; font-family: 'Courier New', Courier, Monospace; font-size: 10pt; margin: 0px; max-height: 300px; overflow: auto; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px"
 id="scid:9ce6104f-a9aa-4a17-a79f-3a39532ebf7c:06a535cb-39a3-45c2-8a93-fc7a50e8d772"
 class="wlWriterEditableSmartContent">
<ol
style="background: #ffffff; margin: 0; padding: 0 0 0 5px; white-space: nowrap">
<li><span style="color:#0000ff">private</span> <span
style="color:#2b91af">Cell</span> createValueCell(</li>

<li style="background: #f3f3f3">&nbsp;&nbsp;&nbsp;&nbsp;<span
style="color:#0000ff">int</span> columnIndex,</li>

<li>&nbsp;&nbsp;&nbsp;&nbsp;<span style="color:#0000ff">int</span>
rowIndex,</li>

<li style="background: #f3f3f3">&nbsp;&nbsp;&nbsp;&nbsp;<span
style="color:#0000ff">object</span> cellValue,</li>

<li>&nbsp;&nbsp;&nbsp;&nbsp;<span
style="color:#2b91af">Nullable</span>&lt;<span
style="color:#0000ff">uint</span>&gt; styleIndex)</li>

<li style="background: #f3f3f3">{</li>

<li>&nbsp;&nbsp;&nbsp;&nbsp;<span style="color:#2b91af">Cell</span>
cell = <span style="color:#0000ff">new</span> <span
style="color:#2b91af">Cell</span>();</li>

<li style="background: #f3f3f3">
&nbsp;&nbsp;&nbsp;&nbsp;cell.CellReference =
getColumnName(columnIndex) + rowIndex;</li>

<li>&nbsp;&nbsp;&nbsp;&nbsp;<span
style="color:#2b91af">CellValue</span> value = <span
style="color:#0000ff">new</span> <span
style="color:#2b91af">CellValue</span>();&nbsp;&nbsp;</li>

<li style="background: #f3f3f3">&nbsp;&nbsp;&nbsp;&nbsp;value.Text
=
cellValue.ToString();&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</li>

<li>&nbsp;</li>

<li style="background: #f3f3f3">&nbsp;&nbsp;&nbsp;&nbsp;<span
style="color:#008000">//apply the cell style if
supplied</span></li>

<li>&nbsp;&nbsp;&nbsp;&nbsp;<span style="color:#0000ff">if</span>
(styleIndex.HasValue)</li>

<li style="background: #f3f3f3">
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;cell.StyleIndex =
styleIndex.Value;</li>

<li>&nbsp;</li>

<li style="background: #f3f3f3">
&nbsp;&nbsp;&nbsp;&nbsp;cell.AppendChild(value);</li>

<li>&nbsp;</li>

<li style="background: #f3f3f3">&nbsp;&nbsp;&nbsp;&nbsp;<span
style="color:#0000ff">return</span> cell;</li>

<li>}</li>
</ol>
</div>

<p>&nbsp;</p>

<p>The final result looks much more professional than the
original:</p>

<p><img
style="border-right-width: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px"
 title="image" border="0" alt="image"
src="/media/1620/WindowsLiveWriter_OpenXMLSDK2.0FormattingExcelValues_13FEF_image_5.png"
 width="500" height="400" /></p>

<p>This code does a lot to expand on the original article, but it
still only covers a small percentage of what is possible within the
OpenXML SDK. Hopefully these samples will help you become familiar
with how the SDK works and you can customize your own solutions to
fit your requirements. I am also providing <a
title="click here to download the updated sample project"
href="/media/1612/lateral8_datatabletoexcel_version2.zip">an
updated sample Visual Studio 2008 project</a> with this article so
you can review the entire solution.</p>
]]></content:encoded></item><item><title>OpenXML SDK 2.0: Export a DataTable to Excel</title><link>http://lateral8.com/articles/2010/3/5/openxml-sdk-20-export-a-datatable-to-excel.aspx</link><pubDate>Fri, 05 Mar 2010 21:53:17 GMT</pubDate><guid>http://lateral8.com/articles/2010/3/5/openxml-sdk-20-export-a-datatable-to-excel.aspx</guid><content:encoded><![CDATA[ 
<p>This post demonstrates how to export a .Net DataTable object to
Excel 2007 using the OpenXML SDK version 2.0.</p>

<p>With the release of the Office 2007 Suite, Microsoft changed the
core document format for the entire Office line to be <a
href="http://en.wikipedia.org/wiki/Office_Open_XML"
target="_blank">based on the Office OpenXML standard</a>. As of
December 2009 the technology preview of the OpenXML SDK 2.0 has
been released and is freely available to download. The OpenXML SDK
allows .Net developers to create and manipulate Office documents.
This is an especially large step forward for web developers, who
have traditionally had few options for exporting data into Excel
directly from their applications.</p>

<h3>Getting Started with the OpenXML SDK 2.0</h3>

<p>Be sure to <a
href="http://www.microsoft.com/downloads/details.aspx?FamilyId=C6E744E5-36E9-45F5-8D8C-331DF206E0D0&amp;displaylang=en#Requirements"
 target="_blank">review the System Requirements for the SDK</a>.
The .Net Framework 3.5 SP1 is required.</p>

<p>First, you will need to <a
title="click here to go to the Microsoft download page"
href="http://www.microsoft.com/downloads/details.aspx?FamilyId=C6E744E5-36E9-45F5-8D8C-331DF206E0D0&amp;displaylang=en"
 target="_blank">download the OpenXML SDK 2.0 package</a>. If you
are in a hurry and have no intention of diving deep into the SDK,
then just download the smaller package (this is only the assembly
you will need to make this work).</p>

<p>For those of you interested in moving beyond the scope of this
article, I suggest also installing the tools package once you have
installed the assemblies (more on this later).</p>

<p>This tutorial (and sample code) does not assume any knowledge of
the DataTable. There can be any number of columns and rows supplied
and the export will still work correctly. I'm sure you have seen
many examples of exporting DataTable objects to CSV format that
take the same approach.</p>

<h3>Create A Visual Studio Project</h3>

<p>Once you have installed the SDK, create a new project in Visual
Studio; in this tutorial I am using an ASP .Net web application
project with C#, although this code will work with any project
type.</p>

<p>Once the project is created, right-click on the project and
select <strong>Add Reference</strong> in Visual Studio. Click on
the <strong>Browse</strong> tab and navigate to the OpenXML SDK
installation folder (the default installation path is
<strong>C:\Program Files\Open XML SDK\V2.0</strong>). Select the
assembly <strong>DocumentFormat.OpenXML.dll</strong> located in the
lib folder and click <strong>OK</strong>.</p>

<p><img
style="border-right-width: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px"
 title="image" border="0" alt="image"
src="/media/1581/WindowsLiveWriter_OpenXMLSDK2.0ExportaDataTabletoExcel_10D24_image_3.png"
 width="640" height="396" /></p>

<p>The OpenXML SDK 2.0 also requires a reference to the
<strong>WindowsBase</strong> assembly (WindowsBase.dll) in order to
use the System.IO.Packaging namespace. Repeat the same steps as
above and add a reference to WindowsBase from the
<strong>.Net</strong> tab.</p>

<h3>&nbsp;</h3>

<h3>Create the ExcelDocument Class</h3>

<p>The ExcelDocument class only exists to generate a new empty
Excel spreadsheet document. The code to create a new document can
be extensive, but this is where the Tools installation of the SDK
comes in very handy:</p>

<p>Locate and run the <strong>OpenXmlSdkTool.exe</strong>
application in the <strong>Tools</strong> folder if you have
installed the tools package. This will launch the OpenXML
productivity tool:</p>

<p><img
style="border-right-width: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px"
 title="image" border="0" alt="image"
src="/media/1586/WindowsLiveWriter_OpenXMLSDK2.0ExportaDataTabletoExcel_10D24_image_6.png"
 width="640" height="480" /></p>

<p>Select <strong>Open File</strong> from the menu or the toolbar
and navigate to any Excel 2007 document you would like to use as a
template. Once you load the document, you will see the structure
outlined on the left side of the application. Now click
<strong>Reflect Code</strong> on the toolbar. The right frame
should now display a complete C# class for the document:</p>

<p><img
style="border-right-width: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px"
 title="image" border="0" alt="image"
src="/media/1591/WindowsLiveWriter_OpenXMLSDK2.0ExportaDataTabletoExcel_10D24_image_9.png"
 width="644" height="484" /></p>

<p>Paste this code into a new file in your project called
<strong>ExcelDocument.cs</strong>. The downloadable sample for this
article includes this file. The template I used is a default Excel
workbook.</p>

<p>You can also save time and gain more granular control over the
template by using a template file at runtime. To create a template
file, create a new Excel 2007 document. Save the document to your
project folder. Instead of executing the CreatePackage method
generated in ExcelDocument.cs, create a copy of the template file
at runtime:</p>

<pre class="code">
<span
style="color: #2b91af">File</span>.Copy(<em>templateFilePath</em>, <em>exportFilePath</em>, <span
 style="color: blue">true</span>);
</pre>

<p>&nbsp;</p>

<p>One advantage of this approach is that you can set custom
properties in your Excel template like corporate headers or cell.
Once you create the blank workbook, save it your project
folder.</p>

<p><em>If you do not have the ability to generate new Excel
documents, there is a blank workbook included in the sample code
with this post.</em></p>

<h3>Create the ExcelExport Class</h3>

<p>Now create a new class file called
<strong>ExcelExport.cs</strong> in your project. Add the following
references to the beginning of the file:</p>

<pre class="code">
<span style="color: blue">using</span> System;
<span style="color: blue">using</span> System.Data;
<span style="color: blue">using</span> System.Linq;
<span
style="color: blue">using</span> DocumentFormat.OpenXml.Packaging;
<span
style="color: blue">using</span> DocumentFormat.OpenXml.Spreadsheet;
</pre>

<p>&nbsp;</p>

<p>Next, add the following method to the file:</p>

<pre class="code">
<span style="color: blue">public void</span> ExportDataTable(
            <span style="color: #2b91af">DataTable</span> table, 
            <span style="color: blue">string</span> exportFile)
        {
            <span
style="color: green">//create the empty spreadsheet template and save the file
            //using the class generated by the Productivity tool
           </span> <span
style="color: #2b91af">ExcelDocument</span> excelDocument = <span
style="color: blue">new</span> <span
style="color: #2b91af">ExcelDocument</span>();
            excelDocument.CreatePackage(exportFile);

            <span
style="color: green">//populate the data into the spreadsheet
           </span> <span style="color: blue">using</span> (<span
style="color: #2b91af">SpreadsheetDocument</span> spreadsheet =
                <span
style="color: #2b91af">SpreadsheetDocument</span>.Open(exportFile, <span
 style="color: blue">true</span>))
            {
                <span
style="color: #2b91af">WorkbookPart</span> workbook = spreadsheet.WorkbookPart;
                <span
style="color: green">//create a reference to Sheet1
               </span> <span
style="color: #2b91af">WorksheetPart</span> worksheet = workbook.WorksheetParts.Last();
                <span
style="color: #2b91af">SheetData</span> data = worksheet.Worksheet.GetFirstChild&lt;<span
 style="color: #2b91af">SheetData</span>&gt;();

                <span
style="color: green">//add column names to the first row
               </span> <span
style="color: #2b91af">Row</span> header = <span
style="color: blue">new</span> <span
style="color: #2b91af">Row</span>();
                header.RowIndex = (<span
style="color: #2b91af">UInt32</span>)1;
                
                <span style="color: blue">foreach</span> (<span
style="color: #2b91af">DataColumn</span> column <span
style="color: blue">in</span> table.Columns)
                {
                    <span
style="color: #2b91af">Cell</span> headerCell = createTextCell(
                        table.Columns.IndexOf(column) + 1, 
                        1, 
                        column.ColumnName);

                    header.AppendChild(headerCell); 
                }
                data.AppendChild(header);

                <span
style="color: green">//loop through each data row
               </span> <span
style="color: #2b91af">DataRow</span> contentRow;
                <span style="color: blue">for</span> (<span
style="color: blue">int</span> i = 0;i &lt; table.Rows.Count; i++)
                {
                    contentRow = table.Rows[i];
                    data.AppendChild(createContentRow(contentRow, i + 2));
                }
            }            
        }
</pre>

<a href="http://11011.net/software/vspaste"></a> 

<p>The method above starts by using the ExcelDocument class created
earlier to create a new file, which is saved to the location
specified in the <strong>exportFile</strong> argument. Once the
file is created, there are two main loops that occur. The first
loops iterates through the DataTable object's columns and creates a
Cell object for each column name using the
<strong>createTextCell</strong> method:</p>

<pre class="code">
<span style="color: blue">private</span> <span
style="color: #2b91af">Cell</span> createTextCell(
    <span style="color: blue">int</span> columnIndex,
    <span style="color: blue">int</span> rowIndex,
    <span style="color: blue">object</span> cellValue)
{
    <span style="color: #2b91af">Cell</span> cell = <span
style="color: blue">new</span> <span
style="color: #2b91af">Cell</span>();

    cell.DataType = <span
style="color: #2b91af">CellValues</span>.InlineString;
    cell.CellReference = getColumnName(columnIndex) + rowIndex;

    <span
style="color: #2b91af">InlineString</span> inlineString = <span
style="color: blue">new</span> <span
style="color: #2b91af">InlineString</span>();
    <span style="color: #2b91af">Text</span> t = <span
style="color: blue">new</span> <span
style="color: #2b91af">Text</span>();

    t.Text = cellValue.ToString();
    inlineString.AppendChild(t);
    cell.AppendChild(inlineString);

    <span style="color: blue">return</span> cell;
}
</pre>

<p>Next, each row is appended to the worksheet using the
<strong>createContentRow</strong> method:</p>

<pre class="code">
<span style="color: blue">private</span> <span
style="color: #2b91af">Row</span> createContentRow(
    <span style="color: #2b91af">DataRow</span> dataRow,
    <span style="color: blue">int</span> rowIndex)
{
    <span style="color: #2b91af">Row</span> row = <span
style="color: blue">new</span> <span style="color: #2b91af">Row

   </span> {
        RowIndex = (<span
style="color: #2b91af">UInt32</span>)rowIndex
    }; 

    <span style="color: blue">for</span> (<span
style="color: blue">int</span> i = 0; i &lt; dataRow.Table.Columns.Count; i++)
    {
        <span
style="color: #2b91af">Cell</span> dataCell = createTextCell(i + 1, rowIndex, dataRow[i]);
        row.AppendChild(dataCell);
    }
    <span style="color: blue">return</span> row;
}
</pre>

<p>The <strong>createTextCell</strong> method uses one additional
supporting method to do the job of mapping the rows and columns to
the correct cell reference, the method
<strong>getColumnName</strong>:</p>

<pre class="code">
<span style="color: blue">private string</span> getColumnName(<span
style="color: blue">int</span> columnIndex)
{
    <span style="color: blue">int</span> dividend = columnIndex;
    <span style="color: blue">string</span> columnName = <span
style="color: #2b91af">String</span>.Empty;
    <span style="color: blue">int</span> modifier;

    <span style="color: blue">while</span> (dividend &gt; 0)
    {
        modifier = (dividend - 1) % 26;
        columnName = 
            <span
style="color: #2b91af">Convert</span>.ToChar(65 + modifier).ToString() + columnName;
        dividend = (<span
style="color: blue">int</span>)((dividend - modifier) / 26);
    }

    <span style="color: blue">return</span> columnName;
}
</pre>

<p>This method provides a quick an easy way to map a column index
number to an Excel column name (A-Z). The Cell object in the
OpenXML SDK requires a valid Excel cell reference (ex. A1, C2) to
be specified, so this method is combined with a row index reference
to create the cell reference. It is important to note that the
indexes here are not zero-based.</p>

<p>Finally, to implement the class above, use the following
code:</p>

<pre class="code">
<span style="color: green">//create DataTable from sample data
</span><span
style="color: #2b91af">DataSet</span> sampleDataSet = <span
style="color: blue">new</span> <span
style="color: #2b91af">DataSet</span>();
sampleDataSet.ReadXml(context.Server.MapPath(<span
style="color: #a31515">"~/sampleData.xml"</span>));
<span
style="color: #2b91af">DataTable</span> productsTable = sampleDataSet.Tables[0];
<span
style="color: blue">string</span> exportFile = context.Server.MapPath(<span
 style="color: #a31515">"~/excelExport.xslx"</span>);

<span style="color: #2b91af">ExcelExport</span> export = <span
style="color: blue">new</span> <span
style="color: #2b91af">ExcelExport</span>();
export.ExportDataTable(productsTable, exportFile);
</pre>

<p>&nbsp;</p>

<p>The export file referenced is saved to disk automatically, so
once the ExportDataTable method completes the file is available to
be passed to the user.</p>

<p>You can <a title="click here to download the example project"
href="/media/1578/openxml_excelexport.zip">download a complete
project example here</a> if you would like to try the sample code
for yourself. The sample projects includes all of the code shown
above, a sample XML data file, and a generic handler that runs the
example code.</p>

<p>I hope you have enjoyed this post, please feel free to post
comments below if you have feedback or questions!</p>
]]></content:encoded></item><item><title>Syncing Your Android Device with Songbird Using MSC</title><link>http://lateral8.com/articles/2010/2/4/syncing-your-android-device-with-songbird-using-msc.aspx</link><pubDate>Thu, 04 Feb 2010 23:51:05 GMT</pubDate><guid>http://lateral8.com/articles/2010/2/4/syncing-your-android-device-with-songbird-using-msc.aspx</guid><content:encoded><![CDATA[ 
<p>Back in the summer I <a
href="/articles/2009/7/3/syncing-your-g1android-device-with-songbird.aspx"
 title="click here to view the previous post">posted a tutorial on
using the FolderSync add-on</a> for the <a
href="http://getsongbird.com/">Songbird music player</a> as a way
to synchronize music to your Android device. If you are using a
previous version of Songbird (earlier than 1.4), that post is
probably the best place to start.</p>

<p>A new and improved version of Songbird is now available. The new
release has a completely new look, but more importantly for Android
users, has a new option for syncing music to your device: the MSC
Add-on. This is probably the closest thing Android user now have to
the iTunes experience for managing music on your device.</p>

<p>If you haven't seen it yet, the new Songbird look is quite
impressive (this is the Purple Rain feather):</p>

<p><img src="/media/1493/WindowsLiveWriter_SyncingYourAndroidDevicewithSongbirdUsin_14F65_image_6.png" width="644" height="409" alt="Songbird 1.4 with the Purple Rain feather (screenshot)" border="0" style="border-right-width: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px"/></p>

<p>Even more impressive is how easy the new synchronization option
is to implement and configure.</p>

<h3>Install Songbird 1.4&nbsp;</h3>

<p>Install Songbird 1.4.3 if you have not already (you must have
Songbird 1.4 or higher). During the installation, the MSC Add-on
should appear as a recommended extension.</p>

<p>If you want to verify that the extension is already installed,
you can select <strong>Add-Ons</strong> from the
<strong>Tools</strong> menu. If you do not see <strong>MSC Device
Support</strong> listed, click the link on the lower right of the
screen labeled <a href="http://addons.songbirdnest.com/">Get
Extensions</a>. Enter <a
href="http://addons.songbirdnest.com/search?query=msc">MSC in the
search box</a> on the top right of the screen.</p>

<p>On the search results page, locate the entry labeled <a
href="http://addons.songbirdnest.com/addon/1667">MSC Device
Support</a>. You should see a download button on the right side of
the screen, click this button to begin the installation
process:<br />
<img src="/media/1498/WindowsLiveWriter_SyncingYourAndroidDevicewithSongbirdUsin_14F65_image_11.png" width="644" height="350" alt="Click on the Download button to install the MSC Device Support Add-on" border="0" class="caption" style="border-right-width: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px"/><br />
<img src="/media/1503/WindowsLiveWriter_SyncingYourAndroidDevicewithSongbirdUsin_14F65_image_5.png" width="441" height="157" alt="click on Install Now when prompted to install the extension (screenshot)" border="0" style="border-right-width: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px"/><br />
<br />
</p>

<p>Click <strong>Install Now</strong>. Once the installation is
finished, you will be prompted to restart Songbird:<br />
<img src="/media/1508/WindowsLiveWriter_SyncingYourAndroidDevicewithSongbirdUsin_14F65_image_12.png" width="584" height="131" alt="restart songbird (screenshot)" border="0" style="border-right-width: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px"/></p>

<h3>Connect Your Android Device</h3>

<p>&nbsp;</p>

<p>Once you restart Songbird, you can plug your Android device into
your computer. Pull down the notification&nbsp;bar and select the
USB Device Connected alert, then&nbsp;tap&nbsp;
<strong>Mount</strong> on your device when prompted; this will
enable USB storage mode.</p>

<p>At this point, you should see your device in the left frame of
the Songbird window. The first time you connect your device
Songbird will prompt you for a name.<br />
<img src="/media/1513/WindowsLiveWriter_SyncingYourAndroidDevicewithSongbirdUsin_14F65_image_26.png" width="188" height="129" alt="device listed on the left side of the Songbird window (screenshot)" border="0" style="border-right-width: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px"/></p>

<h3>Create or Manage Playlists</h3>

<p>&nbsp;</p>

<p>If you are like me and have a large music library and a small SD
card, you will want to only sync specific content. Instead of
manually dragging music to the phone while connected, this is what
I recommend:</p>

<div style="margin-left: 4em">
<ul>
<li>Create a new playlist (or set of playlists) specifically for
your phone. To do this, right-click <strong>Playlists</strong> in
Songbird and select <strong>New Playlist</strong>.</li>

<li>From media view, drag the songs or albums you want to add to
your device over to the new playlist. Your Android device does not
have to be connected when you perform this step.</li>
</ul>
</div>

<h3>Configure Device Options</h3>

<p>&nbsp;</p>

<p>Now, select your Android device on the left side of the screen,
you will see something like the following:<br />
<img src="/media/1518/WindowsLiveWriter_SyncingYourAndroidDevicewithSongbirdUsin_14F65_image_15.png" width="642" height="484" alt="Android device view on Songbird (screenshot)" border="0" style="border-right-width: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px"/></p>

<p>To limit your synchronized content, click the radio button
labeled <strong>Selected playlists</strong>, then place a check
next to each playlist you want to synchronize to your phone; click
<strong>Save</strong>.</p>

<p>There are options to format your SD card and perform a device
repair on the <strong>Tools</strong> tab. I haven't tried either
option, and I wouldn't recommend it: there is no guide that
explains these options (that I can find), and although the format
option is self-explanatory, it's difficult to say what the second
option would do to your device.</p>

<p>The <strong>Settings</strong> tab has some additional
options:<br />
<img src="/media/1523/WindowsLiveWriter_SyncingYourAndroidDevicewithSongbirdUsin_14F65_image_27.png" width="432" height="354" alt="Device settings (screenshot)" border="0" style="border-right-width: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px"/></p>

<p>You can limit the amount of space used for music on the card to
prevent it from becoming full. You can also control what the folder
structure looks like for music on your device, the default
configuration uses the format
<strong><em>Artist\Album\Track</em></strong>.</p>

<p>Finally, there are three controls on the upper right hand side
of the screen:<br />
<img src="/media/1528/WindowsLiveWriter_SyncingYourAndroidDevicewithSongbirdUsin_14F65_image_20.png" width="152" height="40" alt="Device controls (screenshot)" border="0" style="border-right-width: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px"/></p>

<p>The first one will display information about the current
device:<br />
<img src="/media/1533/WindowsLiveWriter_SyncingYourAndroidDevicewithSongbirdUsin_14F65_image_23.png" width="202" height="213" alt="Android device information (screenshot)" border="0" style="border-right-width: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px"/></p>

<p>The second button will eject your device so it can be safely
removed from your computer. The last button will perform a manual
sync (required if you disable automatic syncing). If you have
automatic synchronization, Songbird will immediately begin a sync
every time you connect your device.</p>

<p>By comparison to the previous method, this is an easier and
faster solution, and it's certainly a testament to the rapid
evolution of the Android platform; every day brings better
integration between Android and the other devices and software I
rely on.</p>
]]></content:encoded></item><item><title>How to Convert RGB to Hexadecimal Code in .Net</title><link>http://lateral8.com/articles/2010/2/2/how-to-convert-rgb-to-hexadecimal-code-in-net.aspx</link><pubDate>Tue, 02 Feb 2010 21:09:34 GMT</pubDate><guid>http://lateral8.com/articles/2010/2/2/how-to-convert-rgb-to-hexadecimal-code-in-net.aspx</guid><content:encoded><![CDATA[ 
<p>I ran into an issue today where I needed to convert an RGB (red,
green, blue) color value set into a hexadecimal code. This seemed
like it should be an easy task, but the first few posts I ran into
online used proprietary code to produce the same effect.</p>

<p>These solutions would work well, but I also remembered that in
the past I have been able to easily create .Net Color structures
using the following code:</p>

<pre class="code">
System.Drawing.<span
style="color: #2b91af">Color</span> color = System.Drawing.<span
style="color: #2b91af">ColorTranslator</span>.FromHtml(<span
style="color: #a31515">"#435b9c"</span>);
</pre>

<p>The <a
title="click here to view the System.Drawing.ColorTranslator namespace on MSDN"
 href="http://msdn.microsoft.com/en-us/library/system.drawing.colortranslator.aspx">
System.Drawing.ColorTranslator class</a> provides several useful
methods for dealing with color conversion. The method I needed was
the inverse of the above example, <a
title="click here to view ColorTranslator.ToHtml Method on MSDN"
href="http://msdn.microsoft.com/en-us/library/system.drawing.colortranslator.tohtml.aspx">
the ToHtml method</a>. This method takes a .Net <a
title="click here to view the System.Drawing.Color structure on MSDN"
 href="http://msdn.microsoft.com/en-us/library/system.drawing.color.aspx">
Color structure</a> and returns the hexadecimal color code as a
string object:</p>

<pre class="code">
<span
style="color: blue">string</span> htmlString = System.Drawing.<span
style="color: #2b91af">ColorTranslator</span>.ToHtml(System.Drawing.<span
 style="color: #2b91af">Color</span>.Beige);
</pre>

<p>This is an easy conversion method, but it still doesn't provide
a single line solution for creating the same string from RGB.
However, you can combine the method above with <a
title="click here to view details on the System.Drawing.ColorTranslator.FromHtml method on MSDN"
 href="http://msdn.microsoft.com/en-us/library/cce5h557.aspx">the
FromArgb method</a> found in the System.Color structure to achieve
the one-line conversion:</p>

<pre class="code">
<span
style="color: blue">string</span> htmlString = System.Drawing.<span
style="color: #2b91af">ColorTranslator</span>.ToHtml(System.Drawing.<span
 style="color: #2b91af">Color</span>.FromArgb(85, 120, 50));
</pre>

<blockquote>
<p>The FromArgb method used above is a specific overload that only
passes the red, green and blue values to the color object. It is
important to note that even if you set an alpha value (the level of
opacity in the color) lower than 255 on the color structure, the
alpha value is ignored when the ColorTranslator.ToHtml method
returns the hexadecimal code for the color object. So these two
lines of code produce the same hexadecimal result (#465a9b):</p>

<pre class="code">
<span
style="color: blue">string</span> htmlString = System.Drawing.<span
style="color: #2b91af">ColorTranslator</span>.ToHtml(System.Drawing.<span
 style="color: #2b91af">Color</span>.FromArgb(70, 90, 155));
<span
style="color: blue">string</span> htmlString = System.Drawing.<span
style="color: #2b91af">ColorTranslator</span>.ToHtml(System.Drawing.<span
 style="color: #2b91af">Color</span>.FromArgb(125, 70, 90, 155));
</pre>

<a href="http://11011.net/software/vspaste"></a></blockquote>

<p>These methods have been available in .Net at least since the 1.1
release; if you are like me and deal mostly with the System.Web and
System.Data namespaces on a daily basis, it is easy to overlook
some of the simple solutions provided by the other libraries in
.Net.</p>
]]></content:encoded></item><item><title>Google Chrome Extensions: One Number</title><link>http://lateral8.com/articles/2010/1/28/google-chrome-extensions-one-number.aspx</link><pubDate>Thu, 28 Jan 2010 00:01:02 GMT</pubDate><guid>http://lateral8.com/articles/2010/1/28/google-chrome-extensions-one-number.aspx</guid><content:encoded><![CDATA[ 
<p>If you aren't familiar with Google Chrome or it's newly released
update that includes extensions, I would recommend reading <a
href="/articles/2010/1/25/google-chrome-extensions-ie-tab.aspx"
title="click here to view the previous extension article: IE Tab">my
first post</a>. This post is highlighting another excellent Chrome
extension: <a
href="https://chrome.google.com/extensions/detail/cfkohgkpafhkpdcnfadadcibfboapggi">
One Number</a>.</p>

<p>There are many extensions for Chrome that will display new
message notifications for a specific service, like your GMail or
Google Wave account. One Number eliminates the need for multiple
extensions by showing you a single number when you have new
messages. This single number combines all of the following services
together:</p>

<ul>
<li>GMail</li>

<li>Google Reader</li>

<li>Google Voice</li>

<li>Google Wave</li>
</ul>

<p>Any time you open Chrome, the One Number extension will display
the total number of new messages:</p>

<p><img src="/media/1421/WindowsLiveWriter_GoogleChromeExtensionsOneNumber_14F2E_image_3.png" width="335" height="67" alt="image" border="0" style="border-right-width: 0px; margin: 10px 0px 5px 10px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px"/></p>

<p>The extension icon displays the new message count. As you can
see in the screenshot above, you can view messages per service by
hovering over the icon. You can also click on the icon to show an
expanded view:</p>

<p><a
href="/media/1426/WindowsLiveWriter_GoogleChromeExtensionsOneNumber_14F2E_image_5.png">
<img src="/media/1431/WindowsLiveWriter_GoogleChromeExtensionsOneNumber_14F2E_image_thumb_1.png" width="313" height="246" alt="image" border="0" style="border-right-width: 0px; margin: 5px 0px 5px 10px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px"/></a></p>

<p>The expanded view allows you to manually refresh the list to
check for new messages and provides quick links for each service.
You can also select the Open Unread link&nbsp; to load each service
with unread content into a new Chrome tab.</p>

<p>There are a lot of customization options for One Number as well.
To change options, open the customize menu (the wrench icon) in
Chrome and select <strong>Extensions</strong>.</p>

<p>Locate the entry for one number and select Options on the right
to customize the extension. You can control the refresh interval,
notification colors, and options for each service individually.</p>

<p><img src="/media/1436/WindowsLiveWriter_GoogleChromeExtensionsOneNumber_14F2E_image_8.png" width="644" height="480" alt="The Options page for One Number allows you to control the look and function of the extension." border="0" class="caption" style="border-right-width: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px"/></p>

<p>This is a great extension, the interface and combination of
features are a great example of why extensions are so popular in
the browser community.</p>
]]></content:encoded></item><item><title>Google Chrome Extensions: IE Tab</title><link>http://lateral8.com/articles/2010/1/25/google-chrome-extensions-ie-tab.aspx</link><pubDate>Mon, 25 Jan 2010 20:07:15 GMT</pubDate><guid>http://lateral8.com/articles/2010/1/25/google-chrome-extensions-ie-tab.aspx</guid><content:encoded><![CDATA[ 
<p>Google has posted an official update to the Chrome browser. If
you aren't already using the beta or developer editions of Chrome,
this version most notably adds support for extensions in
Chrome.</p>

<p>Extensions are small add-ons that can be installed on top of the
core browser. Extensions range from simple shortcuts on your
toolbar to utilities like instant page translation or scripts to
share content in your favorite social media site.</p>

<p>Once you have updated your Chrome installation, you can find
extensions by selecting <strong>Extensions</strong> from the tools
menu. Click on the link at the bottom of the page that says <a
href="https://chrome.google.com/extensions"
title="click here to open the Google Chrome extensions page">Get
more extensions</a> to load this site:</p>

<p><a
href="https://chrome.google.com/extensions">https://chrome.google.com/extensions</a></p>

<p>To mark the occasion, I am going to post a few of my favorite
extensions. The first one in the series is the <a
href="https://chrome.google.com/extensions/detail/hehijbfgiekmjfkfjpbkbammjbdenadd">
IE Tab</a> extension. This is a very useful tool for web
developers.</p>

<p>If you work in web development or design, multiple browser
testing is a must. IE Tab allows you to immediately open the page
you are viewing in Chrome (in a new Chrome tab). The new tab uses
Internet Explorer to display the same content. This lets you
quickly test the differences in content and layout between Chrome
and IE without having to switch windows.</p>

<p>Once you install the extension, you will see a new toolbar item
in Chrome:</p>

<p><img src="/media/1365/WindowsLiveWriter_GoogleChromeExtensionsIETab_11AF9_image_3.png" width="33" height="35" alt="IE Tab button in Chrome" border="0" style="border-right-width: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px"/></p>

<p>Any time you are viewing a page and would like to switch between
Chrome and Internet Explorer, click this button to open the same
page in Internet Explorer:</p>

<p><img src="/media/1370/WindowsLiveWriter_GoogleChromeExtensionsIETab_11AF9_image_6.png" width="640" height="476" alt="Chrome browser running Internet Explorer in a seperate tab (screenshot)" border="0" style="border-right-width: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px"/></p>

<p>&nbsp;</p>

<p>You will notice that there is a second control strip located
just below the normal Chrome toolbars. This is where you have
access to&nbsp; Internet Explorer options, bookmarks, and other
controls.</p>

<p>Bookmarks that you add while in the IE tab will automatically
re-open in Internet Explorer.</p>

<p>It is important to note that the Internet Explorer windows do
not share cookies, passwords, or other user-specific information
with Chrome, this is definitely a good thing.</p>

<p>As the developer of IE Tab also states, this is not only a
useful tool for web developers and testers, but it also allows you
to use applications that require Internet Explorer, I currently
deal with two companies that have Internet Explorer-specific
applications.</p>
]]></content:encoded></item><item><title>Sharing Files Between Projects in Visual Studio</title><link>http://lateral8.com/articles/2009/8/6/sharing-files-between-projects-in-visual-studio.aspx</link><pubDate>Mon, 25 Jan 2010 15:33:05 GMT</pubDate><guid>http://lateral8.com/articles/2009/8/6/sharing-files-between-projects-in-visual-studio.aspx</guid><content:encoded><![CDATA[ 
<h3>The Problem</h3>

<p>This probably isn't a common situation, but there are arguable
cases where you may want to share files between projects in a
single solution. In my example, I had the following solution
structure:</p>

<p><strong>/Solution<br />
 /SharedControls<br />
 /Project1<br />
 /Project2<br />
 (etc)</strong></p>

<p>In the SharedControls project, I had stylesheets, theme content,
scripts, and some common user controls that both of the other
projects were using. It wouldn't be too difficult to manually copy
this content to each project, but it's an extra step to remember
and to track updates to each file.</p>

<p>When I was working on this solution setup locally, I found an
easy way to address this problem, courtesy of Scott Guthrie; start
by following the tutorial here:</p>

<p><a
href="http://webproject.scottgu.com/CSharp/UserControls/UserControls.aspx"
 title="http://webproject.scottgu.com/CSharp/UserControls/UserControls.aspx">
http://webproject.scottgu.com/CSharp/UserControls/UserControls.aspx</a></p>

<p>The summary of the tutorial above is to create a web application
project: SharedControls. Then add SharedControls as a project
reference in each of your other projects. After that, add a copy
command line event to the Pre-Build event in each project to copy
the shared files from the SharedControls project.</p>

<p>This is a great solution for a single developer, but it does
have a few issues:</p>

<ul>
<li>The build time is increased, especially if you are copying a
lot of files.</li>

<li>Each file is copied when you&nbsp; debug, build, or publish a
project/solution. even if it is unchanged.</li>

<li>You have to make sure any changes in the shared files are made
in the SharedControls project only.</li>
</ul>

<p>Now, fast forward to my current team's implementation of Visual
Studio Team Foundation Server. A solution like the one above was
added into source control so that multiple developers could begin
working on the projects. The first time someone tried to build a
project, they received a failure message:</p>

<blockquote>
<p>The command "copy
"C:\Projects\Articles\Solution\SharedControls\Controls\*.ascx"
"C:\Projects\Articles\Solution\Project2\Controls\"" exited with
code 1.</p>
</blockquote>

<p>The build operation was failing because of the pre-build event.
When using TFS, your local workspace files are marked as read-only
unless you have the file checked out, so the copy command is unable
to overwrite the existing files, even with the force flag
specified.</p>

<h3>A Solution</h3>

<p>I was able to address the build failures and also come up with a
much better way to manage this type of setup in the process.</p>

<p>First, instead of copying the shared files to each project, you
just set up linked files instead:</p>

<p>Add a reference in each project to the SharedControls project
(just like in the original tutorial). Right click on the project
file and select <strong>Add Reference</strong>:<br />
 <a
href="/media/1076/WindowsLiveWriter_SharingFilesBetweenProjectsinTeamFoundat_7E63_image_2.png"
 target="_blank"><img src="/media/1081/WindowsLiveWriter_SharingFilesBetweenProjectsinTeamFoundat_7E63_image_thumb.png" width="490" height="345" alt="image" border="0" style="border-bottom: 0px; border-left: 0px; display: inline; border-top: 0px; border-right: 0px"/></a></p>

<p>Select the <strong>Projects</strong> tab and select the
SharedControls project, and click <strong>OK</strong>:<br />
 <a
href="/media/1086/WindowsLiveWriter_SharingFilesBetweenProjectsinTeamFoundat_7E63_image10.png"
 target="_blank"><img src="/media/1091/WindowsLiveWriter_SharingFilesBetweenProjectsinTeamFoundat_7E63_image10_thumb.png" width="486" height="410" alt="image" border="0" style="border-bottom: 0px; border-left: 0px; display: inline; border-top: 0px; border-right: 0px"/></a></p>

<p>In Visual Studio, right-click the Project folder or any folder
in the project and select <strong>Add</strong> &gt;
<strong>Existing Item:<br />
 <a
href="/media/1096/WindowsLiveWriter_SharingFilesBetweenProjectsinTeamFoundat_7E63_image14_1.png">
<img src="/media/1101/WindowsLiveWriter_SharingFilesBetweenProjectsinTeamFoundat_7E63_image14_thumb.png" width="500" height="351" alt="image" border="0" style="border-bottom: 0px; border-left: 0px; display: inline; border-top: 0px; border-right: 0px"/></a></strong></p>

<p>Navigate to the SharedControls project folder and select the
file(s) you would like to link. Click the arrow next to the Add
button and select <strong>Add As Link:<br />
 <a
href="/media/1106/WindowsLiveWriter_SharingFilesBetweenProjectsinTeamFoundat_7E63_image19_1.png">
<img src="/media/1111/WindowsLiveWriter_SharingFilesBetweenProjectsinTeamFoundat_7E63_image19_thumb.png" width="505" height="357" alt="image" border="0" style="border-bottom: 0px; border-left: 0px; display: inline; border-top: 0px; border-right: 0px"/></a></strong></p>

<p>Now, any time you change the file from any project, all of the
linked copies stay in sync. The linked file is just a reference to
the copy in the SharedControls folder. If you publish your project
now, you will also see that a physical copy of each linked file
will be added to the target directory, this is exactly what we
wanted!</p>

<p>Now, we're all set. except if you try to debug your project.
more errors?!?</p>

<p>If you have linked control files, aspx pages, scripts, or images
you will notice that all of them are missing when you start the
project in debug mode. This is because the integrated development
server points to the project folder, and the physical versions of
the files no longer exist in your working project directory, even
though they are part of the build.</p>

<p>So you need to make sure that a physical version of the file
exists. Since Team Server no longer manages the project files that
have been linked in each project, the copy operation should no
longer fail.</p>

<p>I mentioned the limitations of Scott Guthrie's solution for
copying files during pre-build. This is the script I used in place
of his original:</p>

<p>xcopy "$(SolutionDir)SharedControls\Controls\*.ascx"
"$(ProjectDir)Controls\" /D /Y<br />
 xcopy "$(SolutionDir)SharedControls\App_Themes\*"
"$(ProjectDir)App_Themes\" /D /Y /S</p>

<p>So you still create physical copies in the development folder of
each linked file, but they are no longer part of the project
itself.</p>

<p><em>The</em> <strong>/D</strong> <em>flag will only copy the
file from the shared projects folder if it is a more recent version
than the one that already exists in the destination folder.
The</em> <strong>/Y</strong> <em>option forces an overwrite if the
file already exists. The</em> <strong>/S</strong> <em>option will
perform a recursive copy operation.</em></p>

<p>Right-click on the Project and select
<strong>Properties</strong>. Click on the <strong>Build
Events</strong> tab on the left and add the xcopy command(s) to the
<strong>Pre-build event command line</strong> field:<br />
 <a
href="/media/1125/WindowsLiveWriter_SharingFilesBetweenProjectsinTeamFoundat_7E63_image24_1.png"
 target="_blank"><img src="/media/1130/WindowsLiveWriter_SharingFilesBetweenProjectsinTeamFoundat_7E63_image24_thumb.png" width="526" height="369" alt="image" border="0" style="border-bottom: 0px; border-left: 0px; display: inline; border-top: 0px; border-right: 0px"/></a></p>

<p>Now if you build your project again, you should be able to debug
without any issues.</p>

<p><strong>One final note:</strong> When you drag and drop a linked
control to your page in design mode, it will show up in the source
view like this:</p>

<pre class="code">
<span>&lt;%</span><span>@</span> <span>Register</span> <span>src</span><span>="../SharedControls/Controls/SampleControl.ascx"</span> <span>tagname</span><span>="SampleControl"<br />
</span> <span>tagprefix</span><span>="uc1"</span> <span>%&gt;
</span>
</pre>

<p>&nbsp;</p>

<p>The src tag is referencing the path to the physical file; You
just need to update this tag to reflect the control's&nbsp;
"location" in the current project:</p>

<pre class="code">
<span>&lt;%</span><span>@</span> <span>Register</span> <span>src</span><span>="Controls/SampleControl.ascx"</span> <span>tagname</span><span>="SampleControl"</span> <span>tagprefix</span><span>="uc1"</span> <span>%&gt;</span>
</pre>

<p><a href="http://11011.net/software/vspaste"></a></p>

<p>&nbsp;</p>

<p>There are many different ways to manage shared content between
projects, and this is one of the more basic approaches. If you are
working under limited resources and cannot dedicate a user to
creating control libraries, this is definitely an approach to
consider. You can minimize duplication of work, and make sure that
you are able to manage your projects in a consistent manner.</p>

<p>You can download a <a
href="/media/1437/lateral8_articles_sharedprojectfiles.zip"
title="click here to download a sample solution for this article">sample
solution here</a> to review how this is set up.</p>
]]></content:encoded></item><item><title>WM Theme: NXE</title><link>http://lateral8.com/articles/2009/7/10/wm-theme-nxe.aspx</link><pubDate>Fri, 10 Jul 2009 16:19:11 GMT</pubDate><guid>http://lateral8.com/articles/2009/7/10/wm-theme-nxe.aspx</guid><content:encoded><![CDATA[ 
<p>&nbsp;</p>

<p>This Windows Mobile theme is a tribute to default theme used in
the <a href="http://www.xbox.com/live/nxe/">new XBox
experience</a>, now available to all XBox 360 owners. Three
landscape wallpapers are included in this theme, and can be used
with any other theme currently on your device.</p>

<h4><img src="/media/1172/WindowsLiveWriter_WindowsMobileThemes_12768_nxe_homescreens_3.jpg" width="491" height="155" alt="nxe_homescreens" border="0" style="border-right-width: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px"/></h4>

<p style="text-align: left"><a href="/media/612/NXE.cab"><img src="/media/1177/WindowsLiveWriter_WindowsMobileThemes_12768_dl_cab_3.jpg" width="127" height="37" alt="dl_cab" border="0" style="border-right-width: 0px; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px"/></a> <a href="/media/615/nxe.zip"><img src="/media/1182/WindowsLiveWriter_WindowsMobileThemes_12768_dl_zip_3.jpg" width="127" height="37" alt="dl_zip" border="0" style="border-right-width: 0px; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px"/></a></p>

<p style="text-align: left">Need installation help? <a
href="/2009/6/19/installing-windows-mobile-themes.aspx"
title="click here for instructions on installing Windows Mobile themes">
Click here</a>.</p>
]]></content:encoded></item></channel></rss>
