<?xml version="1.0" encoding="UTF-8" ?>
<?xml-stylesheet type="text/xsl" href="http://blogs.msdn.com/utility/FeedStylesheets/rss.xsl" media="screen"?><rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:slash="http://purl.org/rss/1.0/modules/slash/" xmlns:wfw="http://wellformedweb.org/CommentAPI/"><channel><title>Quickly Import and Export Excel Data with LINQ to XML</title><link>http://blogs.msdn.com/bethmassi/archive/2007/10/30/quickly-import-and-export-excel-data-with-linq-to-xml.aspx</link><description>One really handy thing to do with relational data is to import and export it to Excel. This can be a total snap using LINQ to XML in Visual Basic 2008. For example, let's say I want to import data from an Excel spreadsheet into a local database file like</description><dc:language>en-US</dc:language><generator>CommunityServer 2.1 SP1 (Build: 61025.2)</generator><item><title>re: Quickly Import and Export Excel Data with LINQ to XML</title><link>http://blogs.msdn.com/bethmassi/archive/2007/10/30/quickly-import-and-export-excel-data-with-linq-to-xml.aspx#5813646</link><pubDate>Thu, 01 Nov 2007 15:56:57 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:5813646</guid><dc:creator>Ryan</dc:creator><description>&lt;p&gt;Nice work beth as usual, but you are unfair.&lt;/p&gt;
&lt;p&gt;You should give the code in VS 2005 too.&lt;/p&gt;
&lt;p&gt;btw good job.&lt;/p&gt;
</description></item><item><title>re: Quickly Import and Export Excel Data with LINQ to XML</title><link>http://blogs.msdn.com/bethmassi/archive/2007/10/30/quickly-import-and-export-excel-data-with-linq-to-xml.aspx#5816533</link><pubDate>Thu, 01 Nov 2007 19:29:00 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:5816533</guid><dc:creator>Beth Massi</dc:creator><description>&lt;p&gt;Hi Ryan,&lt;/p&gt;
&lt;p&gt;LINQ is only available in VS 2008. You can download the beta here: &lt;a rel="nofollow" target="_new" href="http://msdn2.microsoft.com/en-us/vstudio/aa700831.aspx"&gt;http://msdn2.microsoft.com/en-us/vstudio/aa700831.aspx&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;I'd have to take a different approach in VS2005 that wouldn't be as quick. :-) Like using automation or some XSLT.&lt;/p&gt;
</description></item><item><title>New Visual Basic LINQ to XML Videos Released! (Beth Massi)</title><link>http://blogs.msdn.com/bethmassi/archive/2007/10/30/quickly-import-and-export-excel-data-with-linq-to-xml.aspx#5818763</link><pubDate>Thu, 01 Nov 2007 22:08:17 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:5818763</guid><dc:creator>The Visual Basic Team</dc:creator><description>&lt;p&gt;We just released a new set of How-Do-I videos in our LINQ series on LINQ to XML in Visual Basic. These&lt;/p&gt;
</description></item><item><title>New Visual Basic LINQ to XML Videos Released!</title><link>http://blogs.msdn.com/bethmassi/archive/2007/10/30/quickly-import-and-export-excel-data-with-linq-to-xml.aspx#5838978</link><pubDate>Fri, 02 Nov 2007 19:02:42 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:5838978</guid><dc:creator>Beth Massi - Sharing the goodness that is VB</dc:creator><description>&lt;p&gt;We just released a new set of How-Do-I videos in our LINQ series on LINQ to XML in Visual Basic. These&lt;/p&gt;
</description></item><item><title>re: Quickly Import and Export Excel Data with LINQ to XML</title><link>http://blogs.msdn.com/bethmassi/archive/2007/10/30/quickly-import-and-export-excel-data-with-linq-to-xml.aspx#5905548</link><pubDate>Mon, 05 Nov 2007 13:47:26 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:5905548</guid><dc:creator>Duncan</dc:creator><description>&lt;p&gt;I'm getting an error message &amp;quot;Expression cannot be converted into an expression tree&amp;quot; with th efollowing part underlined:&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;Select &amp;lt;Row&amp;gt;&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;lt;Cell&amp;gt;&amp;lt;Data ss:Type=&amp;quot;String&amp;quot;&amp;gt;&amp;lt;%= customer.Abbrev %&amp;gt;&amp;lt;/Data&amp;gt;&amp;lt;/Cell&amp;gt;&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;lt;Cell&amp;gt;&amp;lt;Data ss:Type=&amp;quot;String&amp;quot;&amp;gt;&amp;lt;%= customer.Name %&amp;gt;&amp;lt;/Data&amp;gt;&amp;lt;/Cell&amp;gt;&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;lt;Cell&amp;gt;&amp;lt;Data ss:Type=&amp;quot;String&amp;quot;&amp;gt;&amp;lt;%= customer.Phone %&amp;gt;&amp;lt;/Data&amp;gt;&amp;lt;/Cell&amp;gt;&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;lt;Cell&amp;gt;&amp;lt;Data ss:Type=&amp;quot;String&amp;quot;&amp;gt;&amp;lt;%= customer.Country %&amp;gt;&amp;lt;/Data&amp;gt;&amp;lt;/Cell&amp;gt;&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;lt;/Row&amp;gt;&lt;/p&gt;
&lt;p&gt;The IDE is Visual Studio 2008 9.0.20706.1 Beta 2&lt;/p&gt;
&lt;p&gt;.Net framework 3.5&lt;/p&gt;
&lt;p&gt;Any ideas?&lt;/p&gt;
&lt;p&gt; &amp;nbsp;Thanks &lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; Duncan&lt;/p&gt;
</description></item><item><title>Content Rollup For September and October</title><link>http://blogs.msdn.com/bethmassi/archive/2007/10/30/quickly-import-and-export-excel-data-with-linq-to-xml.aspx#5917759</link><pubDate>Mon, 05 Nov 2007 23:13:38 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:5917759</guid><dc:creator>Beth Massi - Sharing the goodness that is VB</dc:creator><description>&lt;p&gt;Here's a summary of all the content the VB team members, including myself, have created for you on the&lt;/p&gt;
</description></item><item><title>re: Quickly Import and Export Excel Data with LINQ to XML</title><link>http://blogs.msdn.com/bethmassi/archive/2007/10/30/quickly-import-and-export-excel-data-with-linq-to-xml.aspx#5918271</link><pubDate>Mon, 05 Nov 2007 23:36:01 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:5918271</guid><dc:creator>Beth Massi</dc:creator><description>&lt;p&gt;Hi Duncan,&lt;/p&gt;
&lt;p&gt;I recall that being a bug in Beta 2 (now fixed, of course ;-)). To work around this try adding a collection type that's not LINQ to SQL. Something like:&lt;/p&gt;
&lt;p&gt; Dim dummy() As String = {&amp;quot;&amp;quot;}&lt;/p&gt;
&lt;p&gt;Dim customers = From d In dummy _&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; From customer In dbNorthwind.Customers _&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; Order By customer.CompanyName _&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; Select &amp;lt;Row&amp;gt;&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;lt;Cell&amp;gt;&amp;lt;Data ss:Type=&amp;quot;String&amp;quot;&amp;gt;&amp;lt;%= customer.CustomerID %&amp;gt;&amp;lt;/Data&amp;gt;&amp;lt;/Cell&amp;gt;&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;lt;Cell&amp;gt;&amp;lt;Data ss:Type=&amp;quot;String&amp;quot;&amp;gt;&amp;lt;%= customer.CompanyName %&amp;gt;&amp;lt;/Data&amp;gt;&amp;lt;/Cell&amp;gt;&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;lt;Cell&amp;gt;&amp;lt;Data ss:Type=&amp;quot;String&amp;quot;&amp;gt;&amp;lt;%= customer.Phone %&amp;gt;&amp;lt;/Data&amp;gt;&amp;lt;/Cell&amp;gt;&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;lt;Cell&amp;gt;&amp;lt;Data ss:Type=&amp;quot;String&amp;quot;&amp;gt;&amp;lt;%= customer.Country %&amp;gt;&amp;lt;/Data&amp;gt;&amp;lt;/Cell&amp;gt;&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;lt;/Row&amp;gt;&lt;/p&gt;
&lt;p&gt;BTW, today Soma announced that VS 2008 will be released this month! &lt;a rel="nofollow" target="_new" href="http://www.microsoft.com/presspass/press/2007/nov07/11-05TechEdDevelopersPR.mspx"&gt;http://www.microsoft.com/presspass/press/2007/nov07/11-05TechEdDevelopersPR.mspx&lt;/a&gt;&lt;/p&gt;
</description></item><item><title>re: Quickly Import and Export Excel Data with LINQ to XML</title><link>http://blogs.msdn.com/bethmassi/archive/2007/10/30/quickly-import-and-export-excel-data-with-linq-to-xml.aspx#5922570</link><pubDate>Tue, 06 Nov 2007 02:39:50 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:5922570</guid><dc:creator>Curt</dc:creator><description>&lt;p&gt;I had some questions for you and figured you gave us your phone number in case we had some questions or were otherwise bored and lonely. &amp;nbsp;I tried the number and. . .You're a liar! &amp;nbsp;That's not your real phone number. &amp;nbsp;This kind of dishonesty just will not stand.&lt;/p&gt;
</description></item><item><title>re: Quickly Import and Export Excel Data with LINQ to XML</title><link>http://blogs.msdn.com/bethmassi/archive/2007/10/30/quickly-import-and-export-excel-data-with-linq-to-xml.aspx#5922748</link><pubDate>Tue, 06 Nov 2007 02:48:35 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:5922748</guid><dc:creator>Beth Massi</dc:creator><description>&lt;p&gt;LOL Curt. Good one, I missed the example. If I gave my real phone number out on the internet I'd have more problems than just my backlog of email ;-)&lt;/p&gt;
</description></item><item><title>re: Quickly Import and Export Excel Data with LINQ to XML</title><link>http://blogs.msdn.com/bethmassi/archive/2007/10/30/quickly-import-and-export-excel-data-with-linq-to-xml.aspx#6141733</link><pubDate>Mon, 12 Nov 2007 18:12:33 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:6141733</guid><dc:creator>Kerry</dc:creator><description>&lt;p&gt;Beth,&lt;/p&gt;
&lt;p&gt;Using Beta 2 and the &amp;quot;dummy fix&amp;quot; above the xl sheet will not open, the row data is as follows???&lt;/p&gt;
&lt;p&gt;&amp;lt;Row xmlns:ss=&amp;quot;urn:schemas-microsoft-com:office:spreadsheet&amp;quot; xmlns=&amp;quot;urn:schemas-microsoft-com:office:spreadsheet&amp;quot;&amp;gt;&lt;/p&gt;
&lt;p&gt; &amp;nbsp;&amp;lt;Cell&amp;gt;&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp;&amp;lt;Data p4:Type=&amp;quot;String&amp;quot; xmlns:p4=&amp;quot;urn:schemas-microsoft-com:office:spreadsheet&amp;quot;&amp;gt;450813&amp;lt;/Data&amp;gt;&lt;/p&gt;
&lt;p&gt; &amp;nbsp;&amp;lt;/Cell&amp;gt;&lt;/p&gt;
&lt;p&gt; &amp;nbsp;&amp;lt;Cell&amp;gt;&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp;&amp;lt;Data p4:Type=&amp;quot;String&amp;quot; xmlns:p4=&amp;quot;urn:schemas-microsoft-com:office:spreadsheet&amp;quot;&amp;gt;PROTECTION SPRAY WEICON STAINLESS STEEL 400ML&amp;lt;/Data&amp;gt;&lt;/p&gt;
&lt;p&gt; &amp;nbsp;&amp;lt;/Cell&amp;gt;&lt;/p&gt;
&lt;p&gt; &amp;nbsp;&amp;lt;Cell&amp;gt;&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp;&amp;lt;Data p4:Type=&amp;quot;String&amp;quot; xmlns:p4=&amp;quot;urn:schemas-microsoft-com:office:spreadsheet&amp;quot;&amp;gt;3&amp;lt;/Data&amp;gt;&lt;/p&gt;
&lt;p&gt; &amp;nbsp;&amp;lt;/Cell&amp;gt;&lt;/p&gt;
&lt;p&gt;&amp;lt;/Row&amp;gt;&lt;/p&gt;
</description></item><item><title>re: Quickly Import and Export Excel Data with LINQ to XML</title><link>http://blogs.msdn.com/bethmassi/archive/2007/10/30/quickly-import-and-export-excel-data-with-linq-to-xml.aspx#6143032</link><pubDate>Mon, 12 Nov 2007 19:13:32 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:6143032</guid><dc:creator>Kerry</dc:creator><description>&lt;p&gt;Re last post, Fixed, didnt set the ExpandedRowCount!&lt;/p&gt;
</description></item><item><title>re: Quickly Import and Export Excel Data with LINQ to XML</title><link>http://blogs.msdn.com/bethmassi/archive/2007/10/30/quickly-import-and-export-excel-data-with-linq-to-xml.aspx#6400243</link><pubDate>Mon, 19 Nov 2007 16:24:32 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:6400243</guid><dc:creator>Kerry</dc:creator><description>&lt;p&gt;Beth,&lt;/p&gt;
&lt;p&gt;Really useful information.&lt;/p&gt;
&lt;p&gt;Not sure if this is an issue or is known behaviour;-&lt;/p&gt;
&lt;p&gt;With the following in the class;-&lt;/p&gt;
&lt;p&gt;Imports &amp;lt;xmlns=&amp;quot;urn:schemas-microsoft-com:office:spreadsheet&amp;quot;&amp;gt;&lt;/p&gt;
&lt;p&gt;This code accessing Xdocument does not work&lt;/p&gt;
&lt;p&gt; Dim specsX = XDocument.Parse(SpecText)&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;Dim EQ = New With { _&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;.EqName = specsX...&amp;lt;name&amp;gt;.Value, _&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;.EqMake = specsX...&amp;lt;manufacturer&amp;gt;.Value}&lt;/p&gt;
&lt;p&gt;Had to put the code in a seperate class, which prompts the question how do I access the properties in EQ outside of that function ?&lt;/p&gt;
&lt;p&gt;Thanks,&lt;/p&gt;
&lt;p&gt;Kerry&lt;/p&gt;
</description></item><item><title>re: Quickly Import and Export Excel Data with LINQ to XML</title><link>http://blogs.msdn.com/bethmassi/archive/2007/10/30/quickly-import-and-export-excel-data-with-linq-to-xml.aspx#6404238</link><pubDate>Mon, 19 Nov 2007 19:43:47 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:6404238</guid><dc:creator>Beth Massi</dc:creator><description>&lt;p&gt;Hi Kerry,&lt;/p&gt;
&lt;p&gt;I'm not sure what SpecText is in the above code but in order to pass out EQ in this case you would create a class (say you call it MyStuff) with two properties EqName and EqMake then you could do something like:&lt;/p&gt;
&lt;p&gt;Dim EQ As MyStuff = New MyStuff With {....&lt;/p&gt;
&lt;p&gt;Since you can't pass around anonymous types you just need to explicitly create a class first and use that instead.&lt;/p&gt;
&lt;p&gt;HTH,&lt;/p&gt;
&lt;p&gt;-B&lt;/p&gt;
</description></item><item><title>re: Quickly Import and Export Excel Data with LINQ to XML</title><link>http://blogs.msdn.com/bethmassi/archive/2007/10/30/quickly-import-and-export-excel-data-with-linq-to-xml.aspx#6422678</link><pubDate>Tue, 20 Nov 2007 09:14:57 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:6422678</guid><dc:creator>Kerry</dc:creator><description>&lt;p&gt;Beth,&lt;/p&gt;
&lt;p&gt;Thanks for your prompt reply, as always you have the skill to explain in simple terms, solving the problem without going too deep! This iterative learning approach is the 'only' way for many of us trying to earn a living while embracing the new..&lt;/p&gt;
&lt;p&gt;SpectText is a simple string of XML that was extracted from an ntext column in SQL compact. The same code works OK when it is seperate from the imports statement.&lt;/p&gt;
&lt;p&gt;Thanks again,&lt;/p&gt;
&lt;p&gt;Kerry&lt;/p&gt;
</description></item><item><title>re: Quickly Import and Export Excel Data with LINQ to XML</title><link>http://blogs.msdn.com/bethmassi/archive/2007/10/30/quickly-import-and-export-excel-data-with-linq-to-xml.aspx#6656978</link><pubDate>Tue, 04 Dec 2007 22:38:14 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:6656978</guid><dc:creator>Ken</dc:creator><description>&lt;p&gt;I have an excel spreadsheet with data that I want to export to sql using vb.net and xml. I understand how you transferred data from sql to excel but what if you started with excel that has all the data and want to transfer to sql.&lt;/p&gt;
</description></item><item><title>re: Quickly Import and Export Excel Data with LINQ to XML</title><link>http://blogs.msdn.com/bethmassi/archive/2007/10/30/quickly-import-and-export-excel-data-with-linq-to-xml.aspx#6657013</link><pubDate>Tue, 04 Dec 2007 22:42:20 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:6657013</guid><dc:creator>Beth Massi</dc:creator><description>&lt;p&gt;Hi Ken,&lt;/p&gt;
&lt;p&gt;The second part of the example above does exactly that. Take a look at the attached code. Basically you'll need to agree on what identifies a unique row, in this example it's Abbrev. &lt;/p&gt;
&lt;p&gt;HTH,&lt;/p&gt;
&lt;p&gt;-B&lt;/p&gt;
</description></item><item><title>I'll Be Speaking at Code Camp in Victoria, BC</title><link>http://blogs.msdn.com/bethmassi/archive/2007/10/30/quickly-import-and-export-excel-data-with-linq-to-xml.aspx#6973018</link><pubDate>Fri, 04 Jan 2008 02:29:40 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:6973018</guid><dc:creator>Beth Massi - Sharing the goodness that is VB</dc:creator><description>&lt;p&gt;I'll be speaking at the Victoria Code Camp on January 26th so if you're in the area and you have nothing&lt;/p&gt;
</description></item><item><title>re: Quickly Import and Export Excel Data with LINQ to XML</title><link>http://blogs.msdn.com/bethmassi/archive/2007/10/30/quickly-import-and-export-excel-data-with-linq-to-xml.aspx#7045357</link><pubDate>Wed, 09 Jan 2008 23:42:28 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:7045357</guid><dc:creator>Kevin</dc:creator><description>&lt;p&gt;This looks exactly like what I'm looking for. &amp;nbsp;With a couple of bugs worked out. I have not modified the code in the sample. &amp;nbsp;&lt;/p&gt;
&lt;p&gt;In testing, if I add a name to the spreadsheet (which will be important to me), on import, I get the error, &amp;quot;Cannot set column 'Abbrev'. The value violates the MaxLength limit of this column.&amp;quot; &lt;/p&gt;
&lt;p&gt;Any advice?&lt;/p&gt;
</description></item><item><title>re: Quickly Import and Export Excel Data with LINQ to XML</title><link>http://blogs.msdn.com/bethmassi/archive/2007/10/30/quickly-import-and-export-excel-data-with-linq-to-xml.aspx#7045401</link><pubDate>Wed, 09 Jan 2008 23:48:02 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:7045401</guid><dc:creator>Beth Massi</dc:creator><description>&lt;p&gt;Hi Kevin,&lt;/p&gt;
&lt;p&gt;You'll either need to increase the width of the column in the database or limit the Abbrev field to 5 characters in the spreadsheet.&lt;/p&gt;
&lt;p&gt;-B&lt;/p&gt;
</description></item><item><title>re: Quickly Import and Export Excel Data with LINQ to XML</title><link>http://blogs.msdn.com/bethmassi/archive/2007/10/30/quickly-import-and-export-excel-data-with-linq-to-xml.aspx#7045561</link><pubDate>Thu, 10 Jan 2008 00:08:31 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:7045561</guid><dc:creator>Kevin</dc:creator><description>&lt;p&gt;:) Thank you. &amp;nbsp;Simple enough :)&lt;/p&gt;
</description></item><item><title>re: Quickly Import and Export Excel Data with LINQ to XML</title><link>http://blogs.msdn.com/bethmassi/archive/2007/10/30/quickly-import-and-export-excel-data-with-linq-to-xml.aspx#7104522</link><pubDate>Mon, 14 Jan 2008 08:03:03 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:7104522</guid><dc:creator>Andy</dc:creator><description>&lt;p&gt;How would you do this in C#? Please share.&lt;/p&gt;
</description></item><item><title>re: Quickly Import and Export Excel Data with LINQ to XML</title><link>http://blogs.msdn.com/bethmassi/archive/2007/10/30/quickly-import-and-export-excel-data-with-linq-to-xml.aspx#7122858</link><pubDate>Wed, 16 Jan 2008 03:24:13 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:7122858</guid><dc:creator>Kevin</dc:creator><description>&lt;p&gt;Hi Beth,&lt;/p&gt;
&lt;p&gt;I am hoping to build this so multiple users can add information and update the same table using a Windows Forms Application vs the Consul Application. &amp;nbsp;Is there a good reference location for the code differences? Thank you.&lt;/p&gt;
</description></item><item><title>re: Quickly Import and Export Excel Data with LINQ to XML</title><link>http://blogs.msdn.com/bethmassi/archive/2007/10/30/quickly-import-and-export-excel-data-with-linq-to-xml.aspx#7132148</link><pubDate>Wed, 16 Jan 2008 18:36:13 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:7132148</guid><dc:creator>Beth Massi</dc:creator><description>&lt;p&gt;Hi Andy,&lt;/p&gt;
&lt;p&gt;XML Literals are not supported in C# so you would have to construct the document using the LINQ to XML API directly. It's pretty ugly but I think there may be a tool that helps you paste literals into the editor. I'd ask in the forums.&lt;/p&gt;
</description></item><item><title>re: Quickly Import and Export Excel Data with LINQ to XML</title><link>http://blogs.msdn.com/bethmassi/archive/2007/10/30/quickly-import-and-export-excel-data-with-linq-to-xml.aspx#7132166</link><pubDate>Wed, 16 Jan 2008 18:38:42 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:7132166</guid><dc:creator>Beth Massi</dc:creator><description>&lt;p&gt;Hi Kevin,&lt;/p&gt;
&lt;p&gt;The example above (download the attachment to this post) is already a Windows Forms application. To make it multi-user capable you would need to use SQL-Server Express as the database instead of CE. Here are some How-To videos to help get you started: &lt;a rel="nofollow" target="_new" href="http://msdn2.microsoft.com/en-us/vbasic/bb466226.aspx#formsoverdata"&gt;http://msdn2.microsoft.com/en-us/vbasic/bb466226.aspx#formsoverdata&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;HTH,&lt;/p&gt;
&lt;p&gt;-B&lt;/p&gt;
</description></item><item><title>re: Quickly Import and Export Excel Data with LINQ to XML</title><link>http://blogs.msdn.com/bethmassi/archive/2007/10/30/quickly-import-and-export-excel-data-with-linq-to-xml.aspx#7150026</link><pubDate>Fri, 18 Jan 2008 18:41:02 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:7150026</guid><dc:creator>Kevin</dc:creator><description>&lt;p&gt;I've been using Visual Web Developer 2008 Express Edition and SQL-Server Express as a database. &amp;nbsp;Are there How -To videos for incorporating Linq to SQL / XML as a Web Application?&lt;/p&gt;
</description></item><item><title>re: Quickly Import and Export Excel Data with LINQ to XML</title><link>http://blogs.msdn.com/bethmassi/archive/2007/10/30/quickly-import-and-export-excel-data-with-linq-to-xml.aspx#7185999</link><pubDate>Mon, 21 Jan 2008 20:14:55 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:7185999</guid><dc:creator>Jason</dc:creator><description>&lt;p&gt;Hi Beth,&lt;/p&gt;
&lt;p&gt;I am using the VB.net 2008, and I want to import my excel datas into my vb-program.. How can I made such importing from excel file into visual basic? Thanks! &lt;/p&gt;
</description></item><item><title>re: Quickly Import and Export Excel Data with LINQ to XML</title><link>http://blogs.msdn.com/bethmassi/archive/2007/10/30/quickly-import-and-export-excel-data-with-linq-to-xml.aspx#7186469</link><pubDate>Mon, 21 Jan 2008 21:13:00 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:7186469</guid><dc:creator>Beth Massi</dc:creator><description>&lt;p&gt;Hi Kevin,&lt;/p&gt;
&lt;p&gt;I haven't watched them yet, but can check these videos out &lt;a rel="nofollow" target="_new" href="http://www.asp.net/learn/linq-videos/"&gt;http://www.asp.net/learn/linq-videos/&lt;/a&gt; and let us know.&lt;/p&gt;
&lt;p&gt;HTH,&lt;/p&gt;
&lt;p&gt;-B&lt;/p&gt;
</description></item><item><title>re: Quickly Import and Export Excel Data with LINQ to XML</title><link>http://blogs.msdn.com/bethmassi/archive/2007/10/30/quickly-import-and-export-excel-data-with-linq-to-xml.aspx#7186479</link><pubDate>Mon, 21 Jan 2008 21:14:08 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:7186479</guid><dc:creator>Beth Massi</dc:creator><description>&lt;p&gt;Hi Jason,&lt;/p&gt;
&lt;p&gt;The attached example to the post above shows importing and exporting Excel data.&lt;/p&gt;
&lt;p&gt;-B&lt;/p&gt;
</description></item><item><title>re: Quickly Import and Export Excel Data with LINQ to XML</title><link>http://blogs.msdn.com/bethmassi/archive/2007/10/30/quickly-import-and-export-excel-data-with-linq-to-xml.aspx#7224488</link><pubDate>Thu, 24 Jan 2008 20:26:09 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:7224488</guid><dc:creator>Kevin</dc:creator><description>&lt;p&gt;Beth, thank you&lt;/p&gt;
&lt;p&gt;The asp.net learning videos combined with yours are great. &lt;/p&gt;
&lt;p&gt;Quickly. &amp;nbsp;The spread sheet saves. &amp;nbsp;The headers show up in excel but no data. &amp;nbsp;I can see the data laid out in order if I view it as an xml feed in the browser.&lt;/p&gt;
&lt;p&gt;I think its the count+1 addition to the spread sheet code. &amp;nbsp;If I change this portion I get the error, &amp;quot;Compiler Error Message: BC30456: 'Count' is not a member of 'System.Xml.Linq.XElement'.&amp;quot;&lt;/p&gt;
&lt;p&gt;I'm trying to add 'count' as an included member. &amp;nbsp;Any directing would be appreciated.&lt;/p&gt;
&lt;p&gt;Thanks again, Kevin&lt;/p&gt;
</description></item><item><title>re: Quickly Import and Export Excel Data with LINQ to XML</title><link>http://blogs.msdn.com/bethmassi/archive/2007/10/30/quickly-import-and-export-excel-data-with-linq-to-xml.aspx#7261090</link><pubDate>Sun, 27 Jan 2008 02:54:13 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:7261090</guid><dc:creator>Beth Massi</dc:creator><description>&lt;p&gt;Hi Kevin,&lt;/p&gt;
&lt;p&gt;Count is an extension method on the collection returned from the LINQ query above. It sounds like you are returning an XElement from your query. &lt;/p&gt;
&lt;p&gt;-B&lt;/p&gt;
</description></item><item><title>re: Quickly Import and Export Excel Data with LINQ to XML</title><link>http://blogs.msdn.com/bethmassi/archive/2007/10/30/quickly-import-and-export-excel-data-with-linq-to-xml.aspx#7319153</link><pubDate>Wed, 30 Jan 2008 07:03:03 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:7319153</guid><dc:creator>ROy</dc:creator><description>&lt;p&gt;Hi Beth &lt;/p&gt;
&lt;p&gt;thank You for the Forms over video series VB2005&lt;/p&gt;
&lt;p&gt;But my problem is that how can i export excel data to datagridview in visualbasic2005 with a checklist column in the grid...&lt;/p&gt;
&lt;p&gt;Thanks...&lt;/p&gt;
</description></item><item><title>re: Quickly Import and Export Excel Data with LINQ to XML</title><link>http://blogs.msdn.com/bethmassi/archive/2007/10/30/quickly-import-and-export-excel-data-with-linq-to-xml.aspx#7419530</link><pubDate>Mon, 04 Feb 2008 00:28:49 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:7419530</guid><dc:creator>Chris St. John</dc:creator><description>&lt;p&gt;Beth,&lt;/p&gt;
&lt;p&gt;This is great, but for the export it doesn't seem to work if your database contains null values. &amp;nbsp;The dataset returns a conversion error. &amp;nbsp;How would one deal with this?&lt;/p&gt;
&lt;p&gt;Thanks,&lt;/p&gt;
&lt;p&gt;Chris&lt;/p&gt;
</description></item><item><title>re: Quickly Import and Export Excel Data with LINQ to XML</title><link>http://blogs.msdn.com/bethmassi/archive/2007/10/30/quickly-import-and-export-excel-data-with-linq-to-xml.aspx#7450029</link><pubDate>Tue, 05 Feb 2008 02:14:46 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:7450029</guid><dc:creator>Beth Massi</dc:creator><description>&lt;p&gt;Hi Chris,&lt;/p&gt;
&lt;p&gt;You can check for nulls using the If() function in the export query:&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;Dim customers = _&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;From customer In Me.CustomersDataSet.Customers _&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;Where customer.RowState &amp;lt;&amp;gt; DataRowState.Deleted _&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;AndAlso Not customer.IsAbbrevNull _&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;Order By customer.Abbrev _&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;Select &amp;lt;Row&amp;gt;&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;lt;Cell&amp;gt;&amp;lt;Data ss:Type=&amp;quot;String&amp;quot;&amp;gt;&amp;lt;%= customer.Abbrev %&amp;gt;&amp;lt;/Data&amp;gt;&amp;lt;/Cell&amp;gt;&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;lt;Cell&amp;gt;&amp;lt;Data ss:Type=&amp;quot;String&amp;quot;&amp;gt;&amp;lt;%= If(customer.IsNameNull, &amp;quot;&amp;quot;, customer.Name) %&amp;gt;&amp;lt;/Data&amp;gt;&amp;lt;/Cell&amp;gt;&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;lt;Cell&amp;gt;&amp;lt;Data ss:Type=&amp;quot;String&amp;quot;&amp;gt;&amp;lt;%= If(customer.IsPhoneNull, &amp;quot;&amp;quot;, customer.Phone) %&amp;gt;&amp;lt;/Data&amp;gt;&amp;lt;/Cell&amp;gt;&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;lt;Cell&amp;gt;&amp;lt;Data ss:Type=&amp;quot;String&amp;quot;&amp;gt;&amp;lt;%= If(customer.IsCountryNull, &amp;quot;&amp;quot;, customer.Country) %&amp;gt;&amp;lt;/Data&amp;gt;&amp;lt;/Cell&amp;gt;&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;lt;/Row&amp;gt;&lt;/p&gt;
&lt;p&gt;HTH,&lt;/p&gt;
&lt;p&gt;-B&lt;/p&gt;
</description></item><item><title>re: Quickly Import and Export Excel Data with LINQ to XML</title><link>http://blogs.msdn.com/bethmassi/archive/2007/10/30/quickly-import-and-export-excel-data-with-linq-to-xml.aspx#7502237</link><pubDate>Thu, 07 Feb 2008 03:45:56 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:7502237</guid><dc:creator>Chris St. John</dc:creator><description>&lt;p&gt;Thanks for the prompt response Beth! &amp;nbsp;I'm new to VB.NET and was looking at &amp;quot;Iif&amp;quot;, but that seems to evaluate the false condition (hence throwing an exception) even if the condition is true. &amp;nbsp;I wasn't aware that you could use &amp;quot;If&amp;quot; as a traditional ternary operator. &amp;nbsp;Your videos are great!&lt;/p&gt;
&lt;p&gt;PS - Have you covered refering to &amp;quot;named&amp;quot; cells on import (i.e. give the users the ability to move columns around and programatically know where they are still on import)?&lt;/p&gt;
</description></item><item><title>re: Quickly Import and Export Excel Data with LINQ to XML</title><link>http://blogs.msdn.com/bethmassi/archive/2007/10/30/quickly-import-and-export-excel-data-with-linq-to-xml.aspx#7824131</link><pubDate>Thu, 21 Feb 2008 00:46:07 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:7824131</guid><dc:creator>Rick</dc:creator><description>&lt;p&gt;Beth-&lt;/p&gt;
&lt;p&gt;I'm new to Visual Basic and enjoyed your videos. &amp;nbsp;I'm trying to save some data to Excel and would like to base it on your Linq example. But my data is captured in an array instead of a database. &amp;nbsp;Can I create a Query similar to your customer query from an array rather than a database? &lt;/p&gt;
&lt;p&gt;My array: &lt;/p&gt;
&lt;p&gt;CapturedData(X,1) contains an ID&lt;/p&gt;
&lt;p&gt;CaputerdData(X,2) Contains Milliseconds&lt;/p&gt;
&lt;p&gt;CapturedData(X,3) Contains Acceleration X&lt;/p&gt;
&lt;p&gt;CapturedData(X,3) Contains Acceleration Y&lt;/p&gt;
&lt;p&gt;CapturedData(X,3) Contains Acceleration Z&lt;/p&gt;
&lt;p&gt;Thanks!&lt;/p&gt;
</description></item><item><title>re: Quickly Import and Export Excel Data with LINQ to XML</title><link>http://blogs.msdn.com/bethmassi/archive/2007/10/30/quickly-import-and-export-excel-data-with-linq-to-xml.aspx#7861023</link><pubDate>Sat, 23 Feb 2008 22:01:22 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:7861023</guid><dc:creator>Jim Frith</dc:creator><description>&lt;p&gt;I tried using the sample code to create a transfer of my own. &amp;nbsp;I am getting an error on the group join stating that the Range Variable &amp;quot;sightingslist&amp;quot; hides a variable in an enclosing block &amp;nbsp;or a range variable previously defined in the query expression. &amp;nbsp;I think that I have used the same name to difine two objects but I can't figure out which one needs to be changed. &amp;nbsp;&lt;/p&gt;
&lt;p&gt;Can you teel me where the reference to &amp;quot;customer&amp;quot; in your example comes from. &amp;nbsp;I can't see where it is defined. &amp;nbsp;&lt;/p&gt;
&lt;p&gt;here is an extract of my code. &lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;Dim SightingsList = From xmlSightingsList In sheet...&amp;lt;Row&amp;gt; _&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; Let CheckList_IdNo = xmlSightingsList.&amp;lt;Cell&amp;gt;(0) _&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; Let Line_Seq_No = xmlSightingsList.&amp;lt;Cell&amp;gt;(1) _&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; Let Line_Type = xmlSightingsList.&amp;lt;Cell&amp;gt;(2) _&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; Let Common = xmlSightingsList.&amp;lt;Cell&amp;gt;(3) _&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; Let Scientific = xmlSightingsList.&amp;lt;Cell&amp;gt;(4) _&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; Let MBP_Species_IdNo = xmlSightingsList.&amp;lt;Cell&amp;gt;(5) _&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; Let Sighted = xmlSightingsList.&amp;lt;Cell&amp;gt;(6) _&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; Let Sighted_Date = xmlSightingsList.&amp;lt;Cell&amp;gt;(7) _&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;Where _&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; CheckList_IdNo IsNot Nothing _&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;Group Join sightingslist In _&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; (From row In Me.SightingsListDataSet.SightingsList _&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;Where row.RowState &amp;lt;&amp;gt; DataRowState.Deleted _&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; AndAlso Not row.IsChecklist_IdNoNull _&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;Select row) _&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;On sightingslist.Checklist_IdNo Equals CheckList_IdNo And _&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; sightingslist.Line_Seq_No Equals Line_Seq_No _&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;Into Group _&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; Select _&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;CheckList_IdNo = CheckList_IdNo.Value, _&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;Line_Seq_No = Line_Seq_No.Value, _&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;Line_Type = Line_Type.Value, _&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;Common = Common.Value, _&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;Scientific = Scientific.Value, _&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;MBP_Species_IdNo = MBP_Species_IdNo.Value, _&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;Sighted = Sighted.Value, _&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;Sighted_Date = Sighted_Date.Value, _&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;Group _&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; Skip 1&lt;/p&gt;
&lt;p&gt;Thanks&lt;/p&gt;
</description></item><item><title>re: Quickly Import and Export Excel Data with LINQ to XML</title><link>http://blogs.msdn.com/bethmassi/archive/2007/10/30/quickly-import-and-export-excel-data-with-linq-to-xml.aspx#7895806</link><pubDate>Mon, 25 Feb 2008 23:04:19 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:7895806</guid><dc:creator>Jim Frith</dc:creator><description>&lt;p&gt;Hi Beth, &lt;/p&gt;
&lt;p&gt;I resolved the declarations issue. &amp;nbsp;Thanks for the example. &lt;/p&gt;
&lt;p&gt;Jim&lt;/p&gt;
</description></item><item><title>re: Quickly Import and Export Excel Data with LINQ to XML</title><link>http://blogs.msdn.com/bethmassi/archive/2007/10/30/quickly-import-and-export-excel-data-with-linq-to-xml.aspx#8147983</link><pubDate>Tue, 11 Mar 2008 12:19:36 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:8147983</guid><dc:creator>enkhbazar</dc:creator><description>&lt;p&gt;hello my name is enkhbazar how to imported excel data in my sql database for vb.net please help me&lt;/p&gt;
</description></item><item><title>re: Quickly Import and Export Excel Data with LINQ to XML</title><link>http://blogs.msdn.com/bethmassi/archive/2007/10/30/quickly-import-and-export-excel-data-with-linq-to-xml.aspx#8338022</link><pubDate>Wed, 26 Mar 2008 20:13:38 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:8338022</guid><dc:creator>Jon</dc:creator><description>&lt;p&gt;Nice article Beth, although I gave up trying to convert to C#.&lt;/p&gt;
&lt;p&gt;I have one question. How do I get comments out of the XML. I have this piece of xml which has comments on the cell&lt;/p&gt;
&lt;p&gt;&amp;lt;Cell&amp;gt;&lt;/p&gt;
&lt;p&gt;		&amp;lt;Data ss:Type=&amp;quot;String&amp;quot;&amp;gt;Cell value&amp;lt;/Data&amp;gt;&lt;/p&gt;
&lt;p&gt;		&amp;lt;Comment ss:Author=&amp;quot;name&amp;quot;&amp;gt;&lt;/p&gt;
&lt;p&gt;			&amp;lt;ss:Data xmlns=&amp;quot;&lt;a rel="nofollow" target="_new" href="http://www.w3.org/TR/REC-html40&amp;quot;&amp;gt;"&gt;http://www.w3.org/TR/REC-html40&amp;quot;&amp;gt;&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;				&amp;lt;B&amp;gt;&lt;/p&gt;
&lt;p&gt;					&amp;lt;Font html:Face=&amp;quot;Tahoma&amp;quot; x:Family=&amp;quot;Swiss&amp;quot; html:Size=&amp;quot;8&amp;quot; html:Color=&amp;quot;#000000&amp;quot;&amp;gt;name&amp;lt;/Font&amp;gt;&lt;/p&gt;
&lt;p&gt;				&amp;lt;/B&amp;gt;&lt;/p&gt;
&lt;p&gt;				&amp;lt;Font html:Face=&amp;quot;Tahoma&amp;quot; x:Family=&amp;quot;Swiss&amp;quot; html:Size=&amp;quot;8&amp;quot; html:Color=&amp;quot;#000000&amp;quot;&amp;gt;Comments here&amp;lt;/Font&amp;gt;&lt;/p&gt;
&lt;p&gt;			&amp;lt;/ss:Data&amp;gt;&lt;/p&gt;
&lt;p&gt;		&amp;lt;/Comment&amp;gt;&lt;/p&gt;
&lt;p&gt;		&amp;lt;NamedCell ss:Name=&amp;quot;_FilterDatabase&amp;quot;/&amp;gt;&lt;/p&gt;
&lt;p&gt;	&amp;lt;/Cell&amp;gt;&lt;/p&gt;
&lt;p&gt;How can I get those comments out in the query? I tried this but it didn't work&lt;/p&gt;
&lt;p&gt;Let Comments = xmlCustomer.&amp;lt;Cell&amp;gt;(8).&amp;lt;Comments&amp;gt;(0) _&lt;/p&gt;
</description></item><item><title>re: Quickly Import and Export Excel Data with LINQ to XML</title><link>http://blogs.msdn.com/bethmassi/archive/2007/10/30/quickly-import-and-export-excel-data-with-linq-to-xml.aspx#8358643</link><pubDate>Sat, 05 Apr 2008 01:39:01 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:8358643</guid><dc:creator>Beth Massi</dc:creator><description>&lt;p&gt;Hi Jon,&lt;/p&gt;
&lt;p&gt;Assuming you have the right xml namespace Imports at the top, I think what you want is something more like this:&lt;/p&gt;
&lt;p&gt; Dim comments = xmlcustomer...&amp;lt;Comment&amp;gt;.&amp;lt;ss:Data&amp;gt;.&amp;lt;html:Font&amp;gt;&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;For Each comment In comments&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;Console.WriteLine(comment.Value)&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;Next&lt;/p&gt;
&lt;p&gt;HTH,&lt;/p&gt;
&lt;p&gt;-B&lt;/p&gt;
</description></item><item><title>re: Quickly Import and Export Excel Data with LINQ to XML</title><link>http://blogs.msdn.com/bethmassi/archive/2007/10/30/quickly-import-and-export-excel-data-with-linq-to-xml.aspx#8418859</link><pubDate>Wed, 23 Apr 2008 14:39:28 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:8418859</guid><dc:creator>Phil Nelson</dc:creator><description>&lt;p&gt;hi Beth,&lt;/p&gt;
&lt;p&gt;Your work is very much appreciated. Could you tell me how to get the colour of the cell from this Excel spreadsheet please ?&lt;/p&gt;
&lt;p&gt;&amp;lt;Table ss:ExpandedColumnCount=&amp;quot;2&amp;quot; ss:ExpandedRowCount=&amp;quot;5&amp;quot; x:FullColumns=&amp;quot;1&amp;quot;&lt;/p&gt;
&lt;p&gt; &amp;nbsp; x:FullRows=&amp;quot;1&amp;quot;&amp;gt;&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;lt;Row&amp;gt;&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp;&amp;lt;Cell&amp;gt;&amp;lt;Data ss:Type=&amp;quot;String&amp;quot;&amp;gt;AgentID&amp;lt;/Data&amp;gt;&amp;lt;/Cell&amp;gt;&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp;&amp;lt;Cell&amp;gt;&amp;lt;Data ss:Type=&amp;quot;String&amp;quot;&amp;gt;AgentName&amp;lt;/Data&amp;gt;&amp;lt;/Cell&amp;gt;&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;lt;/Row&amp;gt;&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;lt;Row&amp;gt;&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp;&amp;lt;Cell ss:StyleID=&amp;quot;s62&amp;quot;&amp;gt;&amp;lt;Data ss:Type=&amp;quot;String&amp;quot;&amp;gt;1&amp;lt;/Data&amp;gt;&amp;lt;/Cell&amp;gt;&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp;&amp;lt;Cell ss:StyleID=&amp;quot;s62&amp;quot;&amp;gt;&amp;lt;Data ss:Type=&amp;quot;String&amp;quot;&amp;gt;Phil&amp;lt;/Data&amp;gt;&amp;lt;/Cell&amp;gt;&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;lt;/Row&amp;gt;&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;lt;Row&amp;gt;&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp;&amp;lt;Cell ss:StyleID=&amp;quot;s64&amp;quot;&amp;gt;&amp;lt;Data ss:Type=&amp;quot;String&amp;quot;&amp;gt;2&amp;lt;/Data&amp;gt;&amp;lt;/Cell&amp;gt;&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp;&amp;lt;Cell ss:StyleID=&amp;quot;s64&amp;quot;&amp;gt;&amp;lt;Data ss:Type=&amp;quot;String&amp;quot;&amp;gt;Will&amp;lt;/Data&amp;gt;&amp;lt;/Cell&amp;gt;&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;lt;/Row&amp;gt;&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;lt;Row&amp;gt;&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp;&amp;lt;Cell ss:StyleID=&amp;quot;s65&amp;quot;&amp;gt;&amp;lt;Data ss:Type=&amp;quot;String&amp;quot;&amp;gt;3&amp;lt;/Data&amp;gt;&amp;lt;/Cell&amp;gt;&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp;&amp;lt;Cell ss:StyleID=&amp;quot;s65&amp;quot;&amp;gt;&amp;lt;Data ss:Type=&amp;quot;String&amp;quot;&amp;gt;Adam&amp;lt;/Data&amp;gt;&amp;lt;/Cell&amp;gt;&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;lt;/Row&amp;gt;&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;lt;Row&amp;gt;&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp;&amp;lt;Cell&amp;gt;&amp;lt;Data ss:Type=&amp;quot;String&amp;quot;&amp;gt;4&amp;lt;/Data&amp;gt;&amp;lt;/Cell&amp;gt;&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp;&amp;lt;Cell&amp;gt;&amp;lt;Data ss:Type=&amp;quot;String&amp;quot;&amp;gt;Liz&amp;lt;/Data&amp;gt;&amp;lt;/Cell&amp;gt;&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;lt;/Row&amp;gt;&lt;/p&gt;
&lt;p&gt; &amp;nbsp;&amp;lt;/Table&amp;gt;&lt;/p&gt;
&lt;p&gt;Thanks &lt;/p&gt;
</description></item><item><title>re: Quickly Import and Export Excel Data with LINQ to XML</title><link>http://blogs.msdn.com/bethmassi/archive/2007/10/30/quickly-import-and-export-excel-data-with-linq-to-xml.aspx#8419235</link><pubDate>Wed, 23 Apr 2008 18:24:41 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:8419235</guid><dc:creator>Phil Nelson</dc:creator><description>&lt;p&gt;I have discovered the answer, but it is not well documented.&lt;/p&gt;
&lt;p&gt; Dim _book = XDocument.Load(pstrFilePath)&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;Try&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;Dim _sheets = From x In _book...&amp;lt;Worksheet&amp;gt;&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;Dim Agents = From x In _sheets(0)...&amp;lt;Row&amp;gt; _&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; Let AgentID = x.&amp;lt;Cell&amp;gt;(0) _&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; Let AgentName = x.&amp;lt;Cell&amp;gt;(1) _&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; Let CellColour = x.&amp;lt;Cell&amp;gt;.@ss:StyleID _&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; Select _&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; AgentID = AgentID.Value, _&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; AgentName = AgentName.Value, _&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; CellColour = CellColour _&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;Skip (1) &amp;nbsp; 'Skip the first row because that is the header row.&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;For Each row In Agents&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;Dim _lstitem As New ListBoxItem&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;Select Case row.CellColour&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;Case &amp;quot;s62&amp;quot;&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;_lstitem.Foreground = Brushes.Red&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;Case &amp;quot;s64&amp;quot;&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;_lstitem.Foreground = Brushes.LightGreen&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;Case &amp;quot;s66&amp;quot;&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;_lstitem.Foreground = Brushes.Orange&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;Case Else&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;_lstitem.Foreground = Brushes.Black&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;End Select&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;_lstitem.Content = row.AgentID.ToString &amp;amp; &amp;quot; &amp;quot; &amp;amp; row.AgentName.ToString&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;lstAgent.Items.Add(_lstitem)&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;Next&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;Catch ex As Exception&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;End Try&lt;/p&gt;
</description></item><item><title>re: Quickly Import and Export Excel Data with LINQ to XML</title><link>http://blogs.msdn.com/bethmassi/archive/2007/10/30/quickly-import-and-export-excel-data-with-linq-to-xml.aspx#8447898</link><pubDate>Fri, 02 May 2008 02:48:37 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:8447898</guid><dc:creator>Carl Kelley</dc:creator><description>&lt;p&gt;'Beth,&lt;/p&gt;
&lt;p&gt;'&lt;/p&gt;
&lt;p&gt;'Thank you for presenting this technique to BayUG.NET. &amp;nbsp;I took your ball and ran with it.&lt;/p&gt;
&lt;p&gt;' Below is a class that will translate any DataSet into an Excel Xml document:&lt;/p&gt;
&lt;p&gt;Option Strict Off&lt;/p&gt;
&lt;p&gt;Imports System.Data&lt;/p&gt;
&lt;p&gt;Imports System.Linq&lt;/p&gt;
&lt;p&gt;Imports &amp;lt;xmlns=&amp;quot;urn:schemas-microsoft-com:office:spreadsheet&amp;quot;&amp;gt;&lt;/p&gt;
&lt;p&gt;Imports &amp;lt;xmlns:o=&amp;quot;urn:schemas-microsoft-com:office:office&amp;quot;&amp;gt;&lt;/p&gt;
&lt;p&gt;Imports &amp;lt;xmlns:x=&amp;quot;urn:schemas-microsoft-com:office:excel&amp;quot;&amp;gt;&lt;/p&gt;
&lt;p&gt;Imports &amp;lt;xmlns:ss=&amp;quot;urn:schemas-microsoft-com:office:spreadsheet&amp;quot;&amp;gt;&lt;/p&gt;
&lt;p&gt;Public Class DataSetToExcelXml&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp;Public Sub New()&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp;End Sub&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp;Public Shared Function ConvertDataSetToExcelXDocument(ByVal ds As DataSet) As XDocument&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;Dim xmlExcel = &amp;lt;?xml version=&amp;quot;1.0&amp;quot;?&amp;gt;&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;lt;?mso-application progid=&amp;quot;Excel.Sheet&amp;quot;?&amp;gt;&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;lt;Workbook xmlns=&amp;quot;urn:schemas-microsoft-com:office:spreadsheet&amp;quot;&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; xmlns:o=&amp;quot;urn:schemas-microsoft-com:office:office&amp;quot;&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; xmlns:x=&amp;quot;urn:schemas-microsoft-com:office:excel&amp;quot;&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; xmlns:ss=&amp;quot;urn:schemas-microsoft-com:office:spreadsheet&amp;quot;&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; xmlns:html=&amp;quot;&lt;a rel="nofollow" target="_new" href="http://www.w3.org/TR/REC-html40&amp;quot;&amp;gt;"&gt;http://www.w3.org/TR/REC-html40&amp;quot;&amp;gt;&lt;/a&gt;&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;lt;DocumentProperties xmlns=&amp;quot;urn:schemas-microsoft-com:office:office&amp;quot;&amp;gt;&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;lt;Author&amp;gt;&amp;lt;%= Environment.UserName %&amp;gt;&amp;lt;/Author&amp;gt;&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;lt;LastAuthor&amp;gt;&amp;lt;%= Environment.UserName %&amp;gt;&amp;lt;/LastAuthor&amp;gt;&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;lt;Created&amp;gt;&amp;lt;%= DateTime.Now.ToString(&amp;quot;s&amp;quot;) %&amp;gt;&amp;lt;/Created&amp;gt;&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;lt;Version&amp;gt;11.9999&amp;lt;/Version&amp;gt;&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;lt;/DocumentProperties&amp;gt;&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;lt;ExcelWorkbook xmlns=&amp;quot;urn:schemas-microsoft-com:office:excel&amp;quot;&amp;gt;&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;lt;WindowHeight&amp;gt;10000&amp;lt;/WindowHeight&amp;gt;&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;lt;WindowWidth&amp;gt;20000&amp;lt;/WindowWidth&amp;gt;&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;lt;WindowTopX&amp;gt;0&amp;lt;/WindowTopX&amp;gt;&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;lt;WindowTopY&amp;gt;105&amp;lt;/WindowTopY&amp;gt;&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;lt;ProtectStructure&amp;gt;False&amp;lt;/ProtectStructure&amp;gt;&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;lt;ProtectWindows&amp;gt;False&amp;lt;/ProtectWindows&amp;gt;&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;lt;/ExcelWorkbook&amp;gt;&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;lt;Styles&amp;gt;&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;lt;Style ss:ID=&amp;quot;Default&amp;quot; ss:Name=&amp;quot;Normal&amp;quot;&amp;gt;&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;lt;Alignment ss:Vertical=&amp;quot;Bottom&amp;quot;/&amp;gt;&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;lt;Borders/&amp;gt;&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;lt;Font/&amp;gt;&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;lt;Interior/&amp;gt;&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;lt;NumberFormat/&amp;gt;&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;lt;Protection/&amp;gt;&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;lt;/Style&amp;gt;&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;lt;/Styles&amp;gt;&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;lt;%= From t In ds.Tables _&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; Let excelColumnDataType = GetColumnDataTypes(t.columns) _&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; Select &amp;lt;Worksheet ss:Name=&amp;lt;%= t.TableName %&amp;gt;&amp;gt;&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;lt;Table ss:ExpandedColumnCount=&amp;lt;%= t.Columns.Count %&amp;gt; ss:ExpandedRowCount=&amp;lt;%= t.Rows.Count + 1 %&amp;gt; x:FullColumns=&amp;quot;1&amp;quot;&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;x:FullRows=&amp;quot;1&amp;quot;&amp;gt;&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;lt;Row&amp;gt;&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;lt;%= From c In Enumerable.Range(0, t.Columns.Count) _&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;Select &amp;lt;Cell&amp;gt;&amp;lt;Data ss:Type=&amp;quot;String&amp;quot;&amp;gt;&amp;lt;%= t.Columns(c).Caption %&amp;gt;&amp;lt;/Data&amp;gt;&amp;lt;/Cell&amp;gt; %&amp;gt;&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;lt;/Row&amp;gt;&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;lt;%= From r In Enumerable.Range(0, t.Rows.Count) _&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;Select &amp;lt;Row&amp;gt;&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;lt;%= From i In Enumerable.Range(0, t.Columns.Count) _&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; Select &amp;lt;Cell&amp;gt;&amp;lt;Data ss:Type=&amp;lt;%= excelColumnDataType(i) %&amp;gt;&amp;gt;&amp;lt;%= (t.Rows(r))(i) %&amp;gt;&amp;lt;/Data&amp;gt;&amp;lt;/Cell&amp;gt; %&amp;gt;&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;lt;/Row&amp;gt; %&amp;gt;&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;lt;/Table&amp;gt;&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;lt;/Worksheet&amp;gt; %&amp;gt;&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;lt;WorksheetOptions xmlns=&amp;quot;urn:schemas-microsoft-com:office:excel&amp;quot;&amp;gt;&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;lt;Selected/&amp;gt;&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;lt;Panes&amp;gt;&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;lt;Pane&amp;gt;&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;lt;Number&amp;gt;1&amp;lt;/Number&amp;gt;&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;lt;ActiveRow&amp;gt;2&amp;lt;/ActiveRow&amp;gt;&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;lt;ActiveCol&amp;gt;1&amp;lt;/ActiveCol&amp;gt;&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;lt;/Pane&amp;gt;&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;lt;/Panes&amp;gt;&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;lt;ProtectObjects&amp;gt;False&amp;lt;/ProtectObjects&amp;gt;&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;lt;ProtectScenarios&amp;gt;False&amp;lt;/ProtectScenarios&amp;gt;&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;lt;/WorksheetOptions&amp;gt;&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;lt;/Workbook&amp;gt;&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;Return xmlExcel&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp;End Function&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp;Private Shared Function GetColumnDataTypes(ByVal columns As DataColumnCollection) As String()&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;Dim columnDataTypes(columns.Count) As String&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;For i As Integer = 0 To columns.Count - 1&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;columnDataTypes(i) = GetExcelColumnType(columns(i))&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;Next&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;Return columnDataTypes&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp;End Function&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp;' &lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp;' Very simple function to convert .NET value Types&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp;' to Excel DataTypeType as defined by urn:schemas-microsoft-com:office:excel,&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp;' the Excel 2003 Xml Schema.&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp;' &lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp;Public Shared Function GetExcelColumnType(ByVal dc As DataColumn) As String&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;Dim columnType As String = &amp;quot;String&amp;quot;&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;Dim dataColumnTypeName As String = dc.DataType.ToString()&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;Select (dataColumnTypeName)&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;Case &amp;quot;System.String&amp;quot;&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;columnType = &amp;quot;String&amp;quot;&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;Case &amp;quot;System.Decimal&amp;quot;&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;columnType = &amp;quot;Number&amp;quot;&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;Case &amp;quot;System.DateTime&amp;quot;&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;columnType = &amp;quot;DateTime&amp;quot;&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;Case &amp;quot;System.Int16&amp;quot;,&amp;quot;System.Int32&amp;quot;,&amp;quot;System.Int64&amp;quot;&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;columnType = &amp;quot;Integer&amp;quot;&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;Case &amp;quot;System.Single&amp;quot;,&amp;quot;System.Double&amp;quot;&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;columnType = &amp;quot;Float&amp;quot;&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;Case &amp;quot;System.Boolean&amp;quot;&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;columnType = &amp;quot;String&amp;quot;&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;End Select&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;Return columnType&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp;End Function&lt;/p&gt;
&lt;p&gt;End Class&lt;/p&gt;
</description></item><item><title>re: Quickly Import and Export Excel Data with LINQ to XML</title><link>http://blogs.msdn.com/bethmassi/archive/2007/10/30/quickly-import-and-export-excel-data-with-linq-to-xml.aspx#8450969</link><pubDate>Fri, 02 May 2008 19:06:30 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:8450969</guid><dc:creator>Carl Kelley</dc:creator><description>&lt;p&gt;' Correct to Function GetExcelColumnType (above)&lt;/p&gt;
&lt;p&gt;' &lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp;' Very simple function to convert .NET value Types&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp;' to Excel //Cell/Data/@Type as defined by urn:schemas-microsoft-com:office:spreadsheet,&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp;' the Excel 2003 Xml Schema.&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp;' &lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp;Public Shared Function GetExcelColumnType(ByVal dc As DataColumn) As String&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;Dim columnType As String = &amp;quot;String&amp;quot;&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;Dim dataColumnTypeName As String = dc.DataType.ToString()&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;Select (dataColumnTypeName)&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;Case &amp;quot;System.String&amp;quot;&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;columnType = &amp;quot;String&amp;quot;&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;Case &amp;quot;System.DateTime&amp;quot;&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;columnType = &amp;quot;DateTime&amp;quot;&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;Case &amp;quot;System.Int16&amp;quot;, &amp;quot;System.Int32&amp;quot;, &amp;quot;System.Int64&amp;quot;, &amp;quot;System.Decimal&amp;quot;, &amp;quot;System.Single&amp;quot;, &amp;quot;System.Double&amp;quot;&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;columnType = &amp;quot;Number&amp;quot;&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;Case &amp;quot;System.Boolean&amp;quot;&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;columnType = &amp;quot;String&amp;quot;&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;End Select&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;Return columnType&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp;End Function&lt;/p&gt;
</description></item><item><title>re: Quickly Import and Export Excel Data with LINQ to XML</title><link>http://blogs.msdn.com/bethmassi/archive/2007/10/30/quickly-import-and-export-excel-data-with-linq-to-xml.aspx#8451669</link><pubDate>Fri, 02 May 2008 22:28:30 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:8451669</guid><dc:creator>Carl Kelley</dc:creator><description>&lt;p&gt;' Beth,&lt;/p&gt;
&lt;p&gt;' 'Thank you for presenting this technique to BayUG.NET. &amp;nbsp;I took your ball and ran with it.&lt;/p&gt;
&lt;p&gt;' Below is a class that will translate any DataSet into an Excel Xml document.&lt;/p&gt;
&lt;p&gt;' Please delete my previous post. &amp;nbsp;This one works better.&lt;/p&gt;
&lt;p&gt;Option Strict Off&lt;/p&gt;
&lt;p&gt;Imports System.Data&lt;/p&gt;
&lt;p&gt;Imports System.Linq&lt;/p&gt;
&lt;p&gt;Imports &amp;lt;xmlns=&amp;quot;urn:schemas-microsoft-com:office:spreadsheet&amp;quot;&amp;gt;&lt;/p&gt;
&lt;p&gt;Imports &amp;lt;xmlns:o=&amp;quot;urn:schemas-microsoft-com:office:office&amp;quot;&amp;gt;&lt;/p&gt;
&lt;p&gt;Imports &amp;lt;xmlns:x=&amp;quot;urn:schemas-microsoft-com:office:excel&amp;quot;&amp;gt;&lt;/p&gt;
&lt;p&gt;Imports &amp;lt;xmlns:ss=&amp;quot;urn:schemas-microsoft-com:office:spreadsheet&amp;quot;&amp;gt;&lt;/p&gt;
&lt;p&gt;Public Class DataSetToExcelXml&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp;Public Sub New()&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp;End Sub&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp;''' &amp;lt;summary&amp;gt;&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp;''' Convert any ADO.NET DataSet to and Excel workbook&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp;''' where each Table is becomes a Worksheet&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp;''' &amp;lt;/summary&amp;gt;&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp;''' &amp;lt;param name=&amp;quot;ds&amp;quot;&amp;gt;&amp;lt;/param&amp;gt;&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp;''' &amp;lt;returns&amp;gt;&amp;lt;/returns&amp;gt;&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp;''' &amp;lt;remarks&amp;gt;&amp;lt;/remarks&amp;gt;&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp;Public Shared Function ConvertDataSetToExcelXDocument(ByVal ds As DataSet) As XDocument&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;Dim xmlExcel = &amp;lt;?xml version=&amp;quot;1.0&amp;quot;?&amp;gt;&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;lt;?mso-application progid=&amp;quot;Excel.Sheet&amp;quot;?&amp;gt;&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;lt;Workbook xmlns=&amp;quot;urn:schemas-microsoft-com:office:spreadsheet&amp;quot;&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; xmlns:o=&amp;quot;urn:schemas-microsoft-com:office:office&amp;quot;&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; xmlns:x=&amp;quot;urn:schemas-microsoft-com:office:excel&amp;quot;&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; xmlns:ss=&amp;quot;urn:schemas-microsoft-com:office:spreadsheet&amp;quot;&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; xmlns:html=&amp;quot;&lt;a rel="nofollow" target="_new" href="http://www.w3.org/TR/REC-html40&amp;quot;&amp;gt;"&gt;http://www.w3.org/TR/REC-html40&amp;quot;&amp;gt;&lt;/a&gt;&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;lt;DocumentProperties xmlns=&amp;quot;urn:schemas-microsoft-com:office:office&amp;quot;&amp;gt;&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;lt;Author&amp;gt;&amp;lt;%= Environment.UserName %&amp;gt;&amp;lt;/Author&amp;gt;&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;lt;LastAuthor&amp;gt;&amp;lt;%= Environment.UserName %&amp;gt;&amp;lt;/LastAuthor&amp;gt;&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;lt;Created&amp;gt;&amp;lt;%= DateTime.Now.ToString(&amp;quot;s&amp;quot;) %&amp;gt;&amp;lt;/Created&amp;gt;&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;lt;Version&amp;gt;11.9999&amp;lt;/Version&amp;gt;&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;lt;/DocumentProperties&amp;gt;&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;lt;ExcelWorkbook xmlns=&amp;quot;urn:schemas-microsoft-com:office:excel&amp;quot;&amp;gt;&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;lt;WindowHeight&amp;gt;10000&amp;lt;/WindowHeight&amp;gt;&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;lt;WindowWidth&amp;gt;20000&amp;lt;/WindowWidth&amp;gt;&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;lt;WindowTopX&amp;gt;0&amp;lt;/WindowTopX&amp;gt;&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;lt;WindowTopY&amp;gt;105&amp;lt;/WindowTopY&amp;gt;&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;lt;ProtectStructure&amp;gt;False&amp;lt;/ProtectStructure&amp;gt;&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;lt;ProtectWindows&amp;gt;False&amp;lt;/ProtectWindows&amp;gt;&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;lt;/ExcelWorkbook&amp;gt;&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;lt;Styles&amp;gt;&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;lt;Style ss:ID=&amp;quot;Default&amp;quot; ss:Name=&amp;quot;Normal&amp;quot;&amp;gt;&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;lt;Alignment ss:Vertical=&amp;quot;Bottom&amp;quot;/&amp;gt;&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;lt;Borders/&amp;gt;&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;lt;Font/&amp;gt;&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;lt;Interior/&amp;gt;&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;lt;NumberFormat/&amp;gt;&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;lt;Protection/&amp;gt;&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;lt;/Style&amp;gt;&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;lt;Style ss:ID=&amp;quot;String&amp;quot;&amp;gt;&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;lt;Alignment ss:Vertical=&amp;quot;Bottom&amp;quot; ss:Horizontal=&amp;quot;Left&amp;quot;/&amp;gt;&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;lt;/Style&amp;gt;&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;lt;Style ss:ID=&amp;quot;Number&amp;quot;&amp;gt;&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;lt;Alignment ss:Vertical=&amp;quot;Bottom&amp;quot; ss:Horizontal=&amp;quot;Right&amp;quot;/&amp;gt;&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;lt;NumberFormat/&amp;gt;&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;lt;/Style&amp;gt;&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;lt;Style ss:ID=&amp;quot;DateTime&amp;quot;&amp;gt;&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;lt;Alignment ss:Vertical=&amp;quot;Bottom&amp;quot; ss:Horizontal=&amp;quot;Right&amp;quot;/&amp;gt;&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;lt;NumberFormat ss:Format=&amp;quot;Short Date&amp;quot;/&amp;gt;&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;lt;/Style&amp;gt;&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;lt;/Styles&amp;gt;&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;lt;%= From t In ds.Tables _&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; Let excelColumnDataType = GetColumnDataTypes(t.columns) _&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; Select &amp;lt;Worksheet ss:Name=&amp;lt;%= t.TableName %&amp;gt;&amp;gt;&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;lt;Table ss:ExpandedColumnCount=&amp;lt;%= t.Columns.Count %&amp;gt; ss:ExpandedRowCount=&amp;lt;%= t.Rows.Count + 1 %&amp;gt; x:FullColumns=&amp;quot;1&amp;quot;&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;x:FullRows=&amp;quot;1&amp;quot;&amp;gt;&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;lt;%= From c In Enumerable.Range(0, t.Columns.Count) _&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;Select &amp;lt;Column ss:Index=&amp;lt;%= (c + 1) %&amp;gt; ss:StyleID=&amp;lt;%= excelColumnDataType(c) %&amp;gt; ss:AutoFitWidth=&amp;quot;1&amp;quot;/&amp;gt; %&amp;gt;&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;lt;Row&amp;gt;&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;lt;%= From c In Enumerable.Range(0, t.Columns.Count) _&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;Select &amp;lt;Cell&amp;gt;&amp;lt;Data ss:Type=&amp;quot;String&amp;quot;&amp;gt;&amp;lt;%= t.Columns(c).Caption %&amp;gt;&amp;lt;/Data&amp;gt;&amp;lt;/Cell&amp;gt; %&amp;gt;&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;lt;/Row&amp;gt;&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;lt;%= From r In Enumerable.Range(0, t.Rows.Count) _&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;Select &amp;lt;Row&amp;gt;&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;lt;%= From i In Enumerable.Range(0, t.Columns.Count) _&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; Let excelType As String = excelColumnDataType(i) _&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; Select &amp;lt;Cell&amp;gt;&amp;lt;Data ss:Type=&amp;lt;%= excelType %&amp;gt;&amp;gt;&amp;lt;%= (t.Rows(r))(i) %&amp;gt;&amp;lt;/Data&amp;gt;&amp;lt;/Cell&amp;gt; %&amp;gt;&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;lt;/Row&amp;gt; %&amp;gt;&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;lt;/Table&amp;gt;&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;lt;/Worksheet&amp;gt; %&amp;gt;&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;lt;WorksheetOptions xmlns=&amp;quot;urn:schemas-microsoft-com:office:excel&amp;quot;&amp;gt;&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;lt;Selected/&amp;gt;&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;lt;Panes&amp;gt;&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;lt;Pane&amp;gt;&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;lt;Number&amp;gt;1&amp;lt;/Number&amp;gt;&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;lt;ActiveRow&amp;gt;2&amp;lt;/ActiveRow&amp;gt;&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;lt;ActiveCol&amp;gt;1&amp;lt;/ActiveCol&amp;gt;&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;lt;/Pane&amp;gt;&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;lt;/Panes&amp;gt;&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;lt;ProtectObjects&amp;gt;False&amp;lt;/ProtectObjects&amp;gt;&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;lt;ProtectScenarios&amp;gt;False&amp;lt;/ProtectScenarios&amp;gt;&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;lt;/WorksheetOptions&amp;gt;&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;lt;/Workbook&amp;gt;&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;Return xmlExcel&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp;End Function&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp;''' &amp;lt;summary&amp;gt;&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp;''' For debugging replace &amp;quot;(t.Rows(r))(i)&amp;quot; above&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp;''' with &amp;quot;FormatData(t.Rows(r), i, excelType)&amp;quot;&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp;''' &amp;lt;/summary&amp;gt;&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp;''' &amp;lt;param name=&amp;quot;row&amp;quot;&amp;gt;&amp;lt;/param&amp;gt;&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp;''' &amp;lt;param name=&amp;quot;columnIndex&amp;quot;&amp;gt;&amp;lt;/param&amp;gt;&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp;''' &amp;lt;param name=&amp;quot;excelDataType&amp;quot;&amp;gt;&amp;lt;/param&amp;gt;&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp;''' &amp;lt;returns&amp;gt;&amp;lt;/returns&amp;gt;&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp;''' &amp;lt;remarks&amp;gt;&amp;lt;/remarks&amp;gt;&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp;Private Shared Function FormatData(ByVal row As DataRow, ByVal columnIndex As Integer, ByVal excelDataType As String) As String&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;Dim stringValue As String = Nothing&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;Dim data As Object = row.Item(columnIndex)&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;Select Case excelDataType&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;Case &amp;quot;DateTime&amp;quot;&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;stringValue = CType(data, DateTime).ToString(&amp;quot;s&amp;quot;)&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;Case Else&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;stringValue = data.ToString()&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;End Select&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;Return stringValue&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp;End Function&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp;''' &amp;lt;summary&amp;gt;&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp;''' Return a string array of the Excel data types for each table column&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp;''' &amp;lt;/summary&amp;gt;&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp;''' &amp;lt;param name=&amp;quot;columns&amp;quot;&amp;gt;&amp;lt;/param&amp;gt;&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp;''' &amp;lt;returns&amp;gt;&amp;lt;/returns&amp;gt;&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp;''' &amp;lt;remarks&amp;gt;&amp;lt;/remarks&amp;gt;&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp;Private Shared Function GetColumnDataTypes(ByVal columns As DataColumnCollection) As String()&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;Dim columnDataTypes(columns.Count) As String&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;For i As Integer = 0 To columns.Count - 1&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;columnDataTypes(i) = GetExcelColumnType(columns(i))&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;Next&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;Return columnDataTypes&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp;End Function&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp;' &lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp;' Very simple function to convert .NET value Types&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp;' to Excel //Cell/Data/@Type as defined by urn:schemas-microsoft-com:office:spreadsheet,&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp;' the Excel 2003 Xml Schema.&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp;' &lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp;Public Shared Function GetExcelColumnType(ByVal dc As DataColumn) As String&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;Dim columnType As String = &amp;quot;String&amp;quot;&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;Dim dataColumnTypeName As String = dc.DataType.ToString()&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;Select (dataColumnTypeName)&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;Case &amp;quot;System.String&amp;quot;&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;columnType = &amp;quot;String&amp;quot;&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;Case &amp;quot;System.DateTime&amp;quot;&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;columnType = &amp;quot;DateTime&amp;quot;&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;Case &amp;quot;System.Int16&amp;quot;, &amp;quot;System.Int32&amp;quot;, &amp;quot;System.Int64&amp;quot;, &amp;quot;System.Decimal&amp;quot;, &amp;quot;System.Single&amp;quot;, &amp;quot;System.Double&amp;quot;&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;columnType = &amp;quot;Number&amp;quot;&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;Case &amp;quot;System.Boolean&amp;quot;&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;columnType = &amp;quot;String&amp;quot;&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;End Select&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;Return columnType&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp;End Function&lt;/p&gt;
&lt;p&gt;End Class&lt;/p&gt;
</description></item><item><title>re: Quickly Import and Export Excel Data with LINQ to XML</title><link>http://blogs.msdn.com/bethmassi/archive/2007/10/30/quickly-import-and-export-excel-data-with-linq-to-xml.aspx#8584387</link><pubDate>Mon, 09 Jun 2008 11:28:46 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:8584387</guid><dc:creator>Ganesh</dc:creator><description>&lt;p&gt;Hai Everyone&lt;/p&gt;
&lt;p&gt;Please suggest how to export datas from Excel file to txt using miscrosoft office vb.&lt;/p&gt;
&lt;p&gt;Regards&lt;/p&gt;
&lt;p&gt;Ganesh&lt;/p&gt;
</description></item><item><title>re: Quickly Import and Export Excel Data with LINQ to XML</title><link>http://blogs.msdn.com/bethmassi/archive/2007/10/30/quickly-import-and-export-excel-data-with-linq-to-xml.aspx#8670170</link><pubDate>Mon, 30 Jun 2008 07:52:26 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:8670170</guid><dc:creator>Coleman</dc:creator><description>&lt;p&gt;Hi Beth,&lt;/p&gt;
&lt;p&gt;I am writing an app that needs to take data from excel and put into a database - so the code you have given is a great starting point.&lt;/p&gt;
&lt;p&gt;Unfortunately if I edit the spreadsheet or have a column with a null value the LINQ query is set to nothing. &amp;nbsp;If I create a new SS it will work, however only if all columns contain a value. &amp;nbsp;&lt;/p&gt;
&lt;p&gt;I would be great to get this to work reliably, otherwise it's back to exporting the excel data to a txt file for the sake of reliability.&lt;/p&gt;
&lt;p&gt;If anyone responds - Thanks&lt;/p&gt;
</description></item><item><title>re: Quickly Import and Export Excel Data with LINQ to XML</title><link>http://blogs.msdn.com/bethmassi/archive/2007/10/30/quickly-import-and-export-excel-data-with-linq-to-xml.aspx#8672372</link><pubDate>Mon, 30 Jun 2008 21:48:54 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:8672372</guid><dc:creator>Beth Massi</dc:creator><description>&lt;p&gt;Hi Coleman,&lt;/p&gt;
&lt;p&gt;You just need to change the query to check for null and provide a default value instead. Here I modified the query to return the empty string &amp;quot;&amp;quot; if the fields are not filled out. Note that Abbrev still must not be null since that is the key we're using.&lt;/p&gt;
&lt;p&gt;Dim customers = From xmlCustomer In sheet...&amp;lt;Row&amp;gt; _&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; Let Abbrev = xmlCustomer.&amp;lt;Cell&amp;gt;(0) _&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; Let Name = xmlCustomer.&amp;lt;Cell&amp;gt;(1) _&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; Let Phone = xmlCustomer.&amp;lt;Cell&amp;gt;(2) _&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; Let Country = xmlCustomer.&amp;lt;Cell&amp;gt;(3) _&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;Where _&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; Abbrev IsNot Nothing _&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;Group Join customer In _&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;(From row In Me.CustomersDataSet.Customers _&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; Where row.RowState &amp;lt;&amp;gt; DataRowState.Deleted _&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; AndAlso Not row.IsAbbrevNull _&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; Select row) _&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;On customer.Abbrev Equals Abbrev _&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;Into Group _&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;Select _&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;Abbrev = Abbrev.Value, _&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;Name = If(Name Is Nothing, &amp;quot;&amp;quot;, Name.Value), _&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;Phone = If(Phone Is Nothing, &amp;quot;&amp;quot;, Phone.Value), _&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;Country = If(Country Is Nothing, &amp;quot;&amp;quot;, Country.Value), _&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;Group _&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;Skip 1&lt;/p&gt;
&lt;p&gt;HTH,&lt;/p&gt;
&lt;p&gt;-Beth&lt;/p&gt;
</description></item><item><title>re: Quickly Import and Export Excel Data with LINQ to XML</title><link>http://blogs.msdn.com/bethmassi/archive/2007/10/30/quickly-import-and-export-excel-data-with-linq-to-xml.aspx#8673652</link><pubDate>Tue, 01 Jul 2008 01:41:34 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:8673652</guid><dc:creator>Coleman</dc:creator><description>&lt;p&gt;Hi Beth,&lt;/p&gt;
&lt;p&gt;Thank you so for much for the response, works a like a treat.&lt;/p&gt;
&lt;p&gt;I had tried try to process the null, but was miles away on the correct syntax.&lt;/p&gt;
&lt;p&gt;Thanks again&lt;/p&gt;
</description></item><item><title>re: Quickly Import and Export Excel Data with LINQ to XML</title><link>http://blogs.msdn.com/bethmassi/archive/2007/10/30/quickly-import-and-export-excel-data-with-linq-to-xml.aspx#8744652</link><pubDate>Thu, 17 Jul 2008 21:06:43 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:8744652</guid><dc:creator>Alan</dc:creator><description>&lt;p&gt;Hi Beth,&lt;/p&gt;
&lt;p&gt;Thank you for this post, it was very helpful.&lt;/p&gt;
&lt;p&gt;I have a comment/question on it. &amp;nbsp;Your approach works fine assuming that you have the structure of the Customers Excel sheet as static.&lt;/p&gt;
&lt;p&gt;What I'm trying to ask is: Is it possible to have this work dynamically. &amp;nbsp;Where the user would navigate to an Excel document to choose, then import that document (hence the document can have more columns than the original Customers Excel document), and after the document is imported, the data is displayed in the DataGridView following the same rules that you have in your original code except for the data source. &lt;/p&gt;
&lt;p&gt;So the user would be able to import a Products table or a Locations table or any table they choose, and the DataTable in your Dataset would be created during runtime based on the source data.&lt;/p&gt;
&lt;p&gt;Best Regards,&lt;/p&gt;
&lt;p&gt;Alan&lt;/p&gt;
</description></item><item><title>re: Quickly Import and Export Excel Data with LINQ to XML</title><link>http://blogs.msdn.com/bethmassi/archive/2007/10/30/quickly-import-and-export-excel-data-with-linq-to-xml.aspx#8761815</link><pubDate>Mon, 21 Jul 2008 18:43:53 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:8761815</guid><dc:creator>Beth Massi</dc:creator><description>&lt;p&gt;Hi Alan,&lt;/p&gt;
&lt;p&gt;You could probably do this dynamically using an untyped DataSet and just mapping the position of the fields to the Excel columns but it may be brittle. It's better to know at least part of the schema. And you'd still have to know the unique key column to do the group. I'd probably look at the Excel XML mapping or see if there was a way to infer the schema.&lt;/p&gt;
&lt;p&gt;HTH,&lt;/p&gt;
&lt;p&gt;-B&lt;/p&gt;
</description></item><item><title>re: Quickly Import and Export Excel Data with LINQ to XML</title><link>http://blogs.msdn.com/bethmassi/archive/2007/10/30/quickly-import-and-export-excel-data-with-linq-to-xml.aspx#8762947</link><pubDate>Tue, 22 Jul 2008 05:31:32 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:8762947</guid><dc:creator>Alan</dc:creator><description>&lt;p&gt;Hi Beth,&lt;/p&gt;
&lt;p&gt;Thanks for your response.&lt;/p&gt;
&lt;p&gt;I was wondering if it is possible to pass to a LINQ query a table name and a compare value as input parameters of a function, something like this:&lt;/p&gt;
&lt;p&gt;public Sub MyLinq(ByVal MyTable as DataTable, _&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; ByVal MyValue as String)&lt;/p&gt;
&lt;p&gt; &amp;nbsp; Dim customers = _&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;From _&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; Data In MyTable _&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;Where _&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; Data.Field(Of String)(1) = MyValue _&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;Select _&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;Data.Field(Of Integer)(0) _&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;Distinct&lt;/p&gt;
&lt;p&gt; &amp;nbsp; ' some logic here...&lt;/p&gt;
&lt;p&gt;End Sub&lt;/p&gt;
&lt;p&gt;Thanks,&lt;/p&gt;
&lt;p&gt;Alan&lt;/p&gt;
</description></item><item><title>re: Quickly Import and Export Excel Data with LINQ to XML</title><link>http://blogs.msdn.com/bethmassi/archive/2007/10/30/quickly-import-and-export-excel-data-with-linq-to-xml.aspx#8764788</link><pubDate>Tue, 22 Jul 2008 23:24:56 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:8764788</guid><dc:creator>Beth Massi</dc:creator><description>&lt;p&gt;Hi Alan,&lt;/p&gt;
&lt;p&gt;Yep, you could do that, you'll end up with a collection of Integers in your example. Just put a try/catch around the method to catch any runtime errors (i.e. casting or missing fields) and remember to import System.Data&lt;/p&gt;
&lt;p&gt;HTH,&lt;/p&gt;
&lt;p&gt;-B&lt;/p&gt;
</description></item><item><title>re: Quickly Import and Export Excel Data with LINQ to XML</title><link>http://blogs.msdn.com/bethmassi/archive/2007/10/30/quickly-import-and-export-excel-data-with-linq-to-xml.aspx#8766939</link><pubDate>Wed, 23 Jul 2008 16:45:39 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:8766939</guid><dc:creator>Alan</dc:creator><description>&lt;p&gt;Hi Beth,&lt;/p&gt;
&lt;p&gt;Thank you for your response.&lt;/p&gt;
&lt;p&gt;I also want to thank you for the videos on LINQ usages and the other tutorials you made. &amp;nbsp;You have definitely simplified the LINQ learning experience.&lt;/p&gt;
&lt;p&gt;Best Regards,&lt;/p&gt;
&lt;p&gt;Alan&lt;/p&gt;
</description></item><item><title>re: Quickly Import and Export Excel Data with LINQ to XML</title><link>http://blogs.msdn.com/bethmassi/archive/2007/10/30/quickly-import-and-export-excel-data-with-linq-to-xml.aspx#9176488</link><pubDate>Thu, 04 Dec 2008 23:38:46 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:9176488</guid><dc:creator>Chris </dc:creator><description>&lt;p&gt;I am new to programming and this information has been very helpful for a project I have been working on. I do have one question, how can I export data from my database based on current date? I would like to export just records for the current day only.&lt;/p&gt;
</description></item><item><title>re: Quickly Import and Export Excel Data with LINQ to XML</title><link>http://blogs.msdn.com/bethmassi/archive/2007/10/30/quickly-import-and-export-excel-data-with-linq-to-xml.aspx#9231609</link><pubDate>Wed, 17 Dec 2008 23:36:15 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:9231609</guid><dc:creator>Steve</dc:creator><description>&lt;p&gt;Thank you Beth for your example.&lt;/p&gt;
&lt;p&gt;I have an instance where I have a set number of columns, as per your example - works great.&lt;/p&gt;
&lt;p&gt;However, in addition, there can extra, unknown, number of columns after that&lt;/p&gt;
&lt;p&gt;If there a way to check the column - ie to see if it has a header value, and if so, then it will have a value in the row (that is my situation) ?&lt;/p&gt;
&lt;p&gt;ie&lt;/p&gt;
&lt;p&gt;FirstName LastName Dynamic1 Dynamic2&lt;/p&gt;
&lt;p&gt;Beth &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;Massi &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; 500.00 &amp;nbsp; &amp;nbsp; 300.00&lt;/p&gt;</description></item><item><title>re: Quickly Import and Export Excel Data with LINQ to XML</title><link>http://blogs.msdn.com/bethmassi/archive/2007/10/30/quickly-import-and-export-excel-data-with-linq-to-xml.aspx#9237930</link><pubDate>Fri, 19 Dec 2008 00:28:05 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:9237930</guid><dc:creator>Beth Massi</dc:creator><description>&lt;p&gt;Hi Steve,&lt;/p&gt;
&lt;p&gt;If you take a close look I'm already assuming that the columns (except for Abbrev) may not exist in the spreadsheet, however they have to exist in the DataSet. So to capture the extra columns you'll need to modify the database table to to add these fields. Then you can either modify your typed dataset or you can dynamically add untyped columns to the DataTable. Then your query can just check for Nothing (null) value on the extra columns like I'm doing already for the other fields. However you may want to supply a different default value for empty fields than the empty string. &lt;/p&gt;
&lt;p&gt;Dim customers = From xmlCustomer In sheet...&amp;lt;Row&amp;gt; _&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; Let Abbrev = xmlCustomer.&amp;lt;Cell&amp;gt;(0) _&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; Let Name = xmlCustomer.&amp;lt;Cell&amp;gt;(1) _&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; Let Phone = xmlCustomer.&amp;lt;Cell&amp;gt;(2) _&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; Let Country = xmlCustomer.&amp;lt;Cell&amp;gt;(3) _&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; Let DynamicField1 = xmlCustomer.&amp;lt;Cell&amp;gt;(4) _&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;Where _&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; Abbrev IsNot Nothing _&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;Group Join customer In _&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;(From row In Me.CustomersDataSet.Customers _&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; Where row.RowState &amp;lt;&amp;gt; DataRowState.Deleted _&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; AndAlso Not row.IsAbbrevNull _&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; Select row) _&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;On customer.Abbrev Equals Abbrev _&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;Into Group _&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;Select _&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;Abbrev = Abbrev.Value, _&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;Name = If(Name Is Nothing, &amp;quot;&amp;quot;, Name.Value), _&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;Phone = If(Phone Is Nothing, &amp;quot;&amp;quot;, Phone.Value), _&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;Country = If(Country Is Nothing, &amp;quot;&amp;quot;, Country.Value), _&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;DynamicField1 = If(DynamicField1 Is Nothing, &amp;quot;&amp;quot;, DynamicField1.Value), _&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;Group _&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;Skip 1&lt;/p&gt;
&lt;p&gt;HTH,&lt;/p&gt;
&lt;p&gt;-B&lt;/p&gt;
</description></item><item><title>re: Quickly Import and Export Excel Data with LINQ to XML</title><link>http://blogs.msdn.com/bethmassi/archive/2007/10/30/quickly-import-and-export-excel-data-with-linq-to-xml.aspx#9247405</link><pubDate>Mon, 22 Dec 2008 17:59:44 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:9247405</guid><dc:creator>David</dc:creator><description>&lt;p&gt;Hi Beth, &lt;/p&gt;
&lt;p&gt;Great example!&lt;/p&gt;
&lt;p&gt;I have a List(Of List(String)) that stores rows and columns so I don't have the ability to specify which column should be put where. You were able to put &amp;lt;Cell&amp;gt;&amp;lt;Data ss:Type=&amp;quot;String&amp;quot;&amp;gt;&amp;lt;%= customer.Abbrev %&amp;gt;&amp;lt;/Data&amp;gt;&amp;lt;/Cell&amp;gt; as you knew that customer contained the Abbrev field. However my &amp;quot;customer&amp;quot; is just a list of cells with any number of elements. Is there a way of dealing with this too. I guess some kind of nested structure is required but I a not too sure how that would work.&lt;/p&gt;
&lt;p&gt;Thanks&lt;/p&gt;
&lt;p&gt;David&lt;/p&gt;</description></item><item><title>re: Quickly Import and Export Excel Data with LINQ to XML</title><link>http://blogs.msdn.com/bethmassi/archive/2007/10/30/quickly-import-and-export-excel-data-with-linq-to-xml.aspx#9257570</link><pubDate>Tue, 30 Dec 2008 23:25:42 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:9257570</guid><dc:creator>Bob C</dc:creator><description>&lt;p&gt;Beth,&lt;/p&gt;
&lt;p&gt;many thanks for the code, yet it is a bit too advanced for a mere novice like me.&lt;/p&gt;
&lt;p&gt;I am currently trying to edit your code to populate a 2 dimentional array from the excel sheet. &amp;nbsp;I want to update an old app that loads the array from 15 seperate txt files.&lt;/p&gt;
&lt;p&gt;Any pointers will be greatly appreciated.&lt;/p&gt;
&lt;p&gt;Rgds&lt;/p&gt;
&lt;p&gt;Bob&lt;/p&gt;</description></item><item><title>re: Quickly Import and Export Excel Data with LINQ to XML</title><link>http://blogs.msdn.com/bethmassi/archive/2007/10/30/quickly-import-and-export-excel-data-with-linq-to-xml.aspx#9306094</link><pubDate>Sun, 11 Jan 2009 20:44:03 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:9306094</guid><dc:creator>Steve</dc:creator><description>&lt;p&gt;I was able to get it to work with the dataset to excel.&lt;/p&gt;
&lt;p&gt;Great code - thanks.&lt;/p&gt;
&lt;p&gt;Not sure if it's just a bug in Excel, but even though the type is getting set as a 'Number' (ie. a Double), it's not showing up as as double in the spreadsheet.&lt;/p&gt;
&lt;p&gt;Dates work, not numbers ?&lt;/p&gt;</description></item><item><title>re: Quickly Import and Export Excel Data with LINQ to XML</title><link>http://blogs.msdn.com/bethmassi/archive/2007/10/30/quickly-import-and-export-excel-data-with-linq-to-xml.aspx#9339278</link><pubDate>Mon, 19 Jan 2009 06:06:47 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:9339278</guid><dc:creator>pkellner</dc:creator><description>&lt;p&gt;thanks for the hint on save as office 2003 xml, I've been struggling with exporting to xml all kinds of other ways. &amp;nbsp;You are the best Beth!&lt;/p&gt;</description></item><item><title>re: Quickly Import and Export Excel Data with LINQ to XML</title><link>http://blogs.msdn.com/bethmassi/archive/2007/10/30/quickly-import-and-export-excel-data-with-linq-to-xml.aspx#9383905</link><pubDate>Fri, 30 Jan 2009 02:57:30 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:9383905</guid><dc:creator>Ted</dc:creator><description>&lt;p&gt;I am trying to import data from a spreadsheet into and SQL database. &amp;nbsp;I have been trying to use your example as a framework for my situation. &amp;nbsp;The problem I am experiencing is when a cell in the spreadsheet for a given field is blank, the data in the columns next to it are all shifted over to the left and end up basically in the wrong columns.&lt;/p&gt;
&lt;p&gt;the LINQ statement is as follows:&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;Dim Player = From xmlPlayer In sheet...&amp;lt;Row&amp;gt; _&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; Let Col0 = xmlPlayer.&amp;lt;cell&amp;gt;(0) _&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; Let Col1 = xmlPlayer.&amp;lt;cell&amp;gt;(1) _&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; Let Col2 = xmlPlayer.&amp;lt;cell&amp;gt;(2) _&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; Let Col3 = xmlPlayer.&amp;lt;cell&amp;gt;(3) _&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; Let Col4 = xmlPlayer.&amp;lt;Cell&amp;gt;(4) _&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; Let Col5 = xmlPlayer.&amp;lt;Cell&amp;gt;(5) _&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; Let Col6 = xmlPlayer.&amp;lt;Cell&amp;gt;(6) _&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; Let Col7 = xmlPlayer.&amp;lt;Cell&amp;gt;(7) _&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; Let Col8 = xmlPlayer.&amp;lt;Cell&amp;gt;(8) _&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; Let Col9 = xmlPlayer.&amp;lt;Cell&amp;gt;(9) _&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; Let Col10 = xmlPlayer.&amp;lt;Cell&amp;gt;(10) _&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; Let Col11 = xmlPlayer.&amp;lt;Cell&amp;gt;(11) _&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; Let Col12 = xmlPlayer.&amp;lt;Cell&amp;gt;(12) _&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; Where _&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; Col0 IsNot Nothing _&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; Group xmlPlayer By Col1, Col0, Col2, Col3, Col4, Col5, Col6, Col7, _&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;Col8, Col9, Col10, Col11, Col12 Into Group _&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;Select _&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;Col0 = If(Col0 Is Nothing, &amp;quot;&amp;quot;, Col0.Value), _&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;Col1 = If(Col1 Is Nothing, &amp;quot;&amp;quot;, Col1.Value), _&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;Col2 = If(Col2 Is Nothing, &amp;quot;&amp;quot;, Col2.Value), _&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;Col3 = If(Col3 Is Nothing, &amp;quot;&amp;quot;, Col3.Value), _&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;Col4 = If(Col4 Is Nothing, &amp;quot;&amp;quot;, Col4.Value), _&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;Col5 = If(Col5 Is Nothing, &amp;quot;&amp;quot;, Col5.Value), _&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;Col6 = If(Col6 Is Nothing, &amp;quot;&amp;quot;, Col6.Value), _&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;col7 = If(Col7 Is Nothing, &amp;quot;&amp;quot;, Col7.Value), _&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;col8 = If(Col8 Is Nothing, &amp;quot;&amp;quot;, Col8.Value), _&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;col9 = If(Col9 Is Nothing, &amp;quot;&amp;quot;, Col9.Value), _&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;col10 = If(Col10 Is Nothing, &amp;quot;&amp;quot;, Col10.Value), _&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;col11 = If(Col11 Is Nothing, &amp;quot;&amp;quot;, Col11.Value), _&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;col12 = If(Col12 Is Nothing, &amp;quot;&amp;quot;, Col12.Value), _&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;Group _&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;Skip 0&lt;/p&gt;
&lt;p&gt;And a sample of the XML from the Excel Spreadsheet:&lt;/p&gt;
&lt;p&gt; &amp;lt;ss:Worksheet ss:Name=&amp;quot;Sheet1&amp;quot;&amp;gt;&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp;&amp;lt;ss:Table ss:ExpandedColumnCount=&amp;quot;5&amp;quot; ss:ExpandedRowCount=&amp;quot;24&amp;quot; x:FullColumns=&amp;quot;1&amp;quot; x:FullRows=&amp;quot;1&amp;quot;&amp;gt;&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;lt;ss:Row&amp;gt;&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;lt;ss:Cell&amp;gt;&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;lt;ss:Data ss:Type=&amp;quot;String&amp;quot;&amp;gt;First Name&amp;lt;/ss:Data&amp;gt;&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;lt;/ss:Cell&amp;gt;&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;lt;ss:Cell&amp;gt;&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;lt;ss:Data ss:Type=&amp;quot;String&amp;quot;&amp;gt;Last Name&amp;lt;/ss:Data&amp;gt;&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;lt;/ss:Cell&amp;gt;&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;lt;ss:Cell&amp;gt;&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;lt;ss:Data ss:Type=&amp;quot;String&amp;quot;&amp;gt;Account Number&amp;lt;/ss:Data&amp;gt;&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;lt;/ss:Cell&amp;gt;&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;lt;ss:Cell&amp;gt;&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;lt;ss:Data ss:Type=&amp;quot;String&amp;quot;&amp;gt;Member Type&amp;lt;/ss:Data&amp;gt;&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;lt;/ss:Cell&amp;gt;&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;lt;ss:Cell&amp;gt;&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;lt;ss:Data ss:Type=&amp;quot;String&amp;quot;&amp;gt;Gender&amp;lt;/ss:Data&amp;gt;&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;lt;/ss:Cell&amp;gt;&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;lt;/ss:Row&amp;gt;&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;lt;ss:Row&amp;gt;&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;lt;ss:Cell&amp;gt;&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;lt;ss:Data ss:Type=&amp;quot;String&amp;quot;&amp;gt;Bill&amp;lt;/ss:Data&amp;gt;&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;lt;/ss:Cell&amp;gt;&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;lt;ss:Cell&amp;gt;&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;lt;ss:Data ss:Type=&amp;quot;String&amp;quot;&amp;gt;Jones&amp;lt;/ss:Data&amp;gt;&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;lt;/ss:Cell&amp;gt;&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;lt;ss:Cell&amp;gt;&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;lt;ss:Data ss:Type=&amp;quot;Number&amp;quot;&amp;gt;1222&amp;lt;/ss:Data&amp;gt;&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;lt;/ss:Cell&amp;gt;&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;lt;ss:Cell&amp;gt;&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;lt;ss:Data ss:Type=&amp;quot;String&amp;quot;&amp;gt;Principle&amp;lt;/ss:Data&amp;gt;&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;lt;/ss:Cell&amp;gt;&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;lt;ss:Cell&amp;gt;&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;lt;ss:Data ss:Type=&amp;quot;String&amp;quot;&amp;gt;M&amp;lt;/ss:Data&amp;gt;&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;lt;/ss:Cell&amp;gt;&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;lt;/ss:Row&amp;gt;&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;lt;ss:Row&amp;gt;&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;lt;ss:Cell&amp;gt;&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;lt;ss:Data ss:Type=&amp;quot;String&amp;quot;&amp;gt;Ron&amp;lt;/ss:Data&amp;gt;&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;lt;/ss:Cell&amp;gt;&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;lt;ss:Cell&amp;gt;&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;lt;ss:Data ss:Type=&amp;quot;String&amp;quot;&amp;gt;Smith&amp;lt;/ss:Data&amp;gt;&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;lt;/ss:Cell&amp;gt;&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;lt;ss:Cell ss:Index=&amp;quot;4&amp;quot;&amp;gt;&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;lt;ss:Data ss:Type=&amp;quot;String&amp;quot;&amp;gt;Guest&amp;lt;/ss:Data&amp;gt;&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;lt;/ss:Cell&amp;gt;&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;lt;ss:Cell&amp;gt;&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;lt;ss:Data ss:Type=&amp;quot;String&amp;quot;&amp;gt;M&amp;lt;/ss:Data&amp;gt;&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;lt;/ss:Cell&amp;gt;&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;lt;/ss:Row&amp;gt;&lt;/p&gt;
&lt;p&gt;Where the blank cell is located the XML returns:&lt;/p&gt;
&lt;p&gt;&amp;lt;ss:Cell ss:Index=&amp;quot;4&amp;quot;&amp;gt;&lt;/p&gt;
&lt;p&gt;For some reason it is ignored and a blank or &amp;quot;&amp;quot; is not inserted into my datatable. &amp;nbsp;Hopefully you can shed some light on how to resolve this.&lt;/p&gt;
&lt;p&gt;Thanks!!&lt;/p&gt;
&lt;p&gt;Ted&lt;/p&gt;</description></item><item><title>re: Quickly Import and Export Excel Data with LINQ to XML</title><link>http://blogs.msdn.com/bethmassi/archive/2007/10/30/quickly-import-and-export-excel-data-with-linq-to-xml.aspx#9558790</link><pubDate>Tue, 21 Apr 2009 12:51:17 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:9558790</guid><dc:creator>Paul</dc:creator><description>&lt;p&gt;Great 'how to'.&lt;/p&gt;
&lt;p&gt;I'm trying to modify it to work with my app which uses an Access database. Its a multiuser app and the data is on a different machine to the app. Connection strings are set up accordingly and the app works fine in all other respects.&lt;/p&gt;
&lt;p&gt;My dataset contains the data that I want to export - it appears on the form as a child grid as described in one of your earlier posts/videos. It compiles OK and the app runs OK but when I hit the Export button I only get the header row appearing in the spreadsheet.&lt;/p&gt;
&lt;p&gt;Does your example code requery the dataset or is it executing a new query against the .sdf? If so I suspect that this is where I'm having problems using a remote .mdb file.&lt;/p&gt;
&lt;p&gt;I am obviously missing something....but what?&lt;/p&gt;
&lt;p&gt;Hope you can help - keep up the good work!&lt;/p&gt;</description></item><item><title>re: Quickly Import and Export Excel Data with LINQ to XML</title><link>http://blogs.msdn.com/bethmassi/archive/2007/10/30/quickly-import-and-export-excel-data-with-linq-to-xml.aspx#9625456</link><pubDate>Mon, 18 May 2009 18:59:03 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:9625456</guid><dc:creator>Mark Cafazzo</dc:creator><description>&lt;p&gt;I've encountered an issue while trying to implement this approach (by the way, great article! - it prompted me to switch to VB for the Excel handling, while most of our code is C#!): &amp;nbsp;if the excel sheet contains formulas in some of the cells, their values are not accessible at the time the rows are enumerated. &amp;nbsp;Any ideas? &amp;nbsp;Thanks Beth!&lt;/p&gt;</description></item><item><title>re: Quickly Import and Export Excel Data with LINQ to XML</title><link>http://blogs.msdn.com/bethmassi/archive/2007/10/30/quickly-import-and-export-excel-data-with-linq-to-xml.aspx#9891788</link><pubDate>Sat, 05 Sep 2009 17:54:55 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:9891788</guid><dc:creator>Trenton</dc:creator><description>&lt;p&gt;Great Stuff...&lt;/p&gt;
&lt;p&gt;Took me a little tweaking to get it to work with my application. &amp;nbsp;My question is how do I go about converting the r.mydate = whatever.mydate string so it can be inserted into a date container...I keep getting a wrong format error telling me I need to parse the string before inserting it &amp;nbsp;any help would be great&lt;/p&gt;
&lt;p&gt;Thanks&lt;/p&gt;</description></item><item><title>re: Quickly Import and Export Excel Data with LINQ to XML</title><link>http://blogs.msdn.com/bethmassi/archive/2007/10/30/quickly-import-and-export-excel-data-with-linq-to-xml.aspx#9892782</link><pubDate>Tue, 08 Sep 2009 22:55:14 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:9892782</guid><dc:creator>Beth Massi</dc:creator><description>&lt;p&gt;Hi Trenton,&lt;/p&gt;
&lt;p&gt;You should be able to use the VB date functions to check the string and then convert it. Something like&lt;/p&gt;
&lt;p&gt;If IsDate(mydate) Then&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp;r.MyDate = CDate(mydate)&lt;/p&gt;
&lt;p&gt;End If&lt;/p&gt;
&lt;p&gt;HTH,&lt;/p&gt;
&lt;p&gt;-B&lt;/p&gt;
</description></item><item><title>re: Quickly Import and Export Excel Data with LINQ to XML</title><link>http://blogs.msdn.com/bethmassi/archive/2007/10/30/quickly-import-and-export-excel-data-with-linq-to-xml.aspx#9903393</link><pubDate>Mon, 05 Oct 2009 22:38:51 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:9903393</guid><dc:creator>Eric Gelders</dc:creator><description>&lt;p&gt;Excellent stuff Beth, especially for a starter on LINQ to SQL. Took me some tweaking to get it going (especially the Dim sheet =... statement took me some time to reproduce myself. Saving the Excel file as xml wasn't the problem; pasting it into my own project took a bit of debugging :-( ).&lt;/p&gt;
&lt;p&gt;Anyway, I ran this stuff against Excel 2007, but I saved the Excel file as 2003 XML file. Will you ever make a version for Excel 2007? But thanx anyway!&lt;/p&gt;
</description></item><item><title>re: Quickly Import and Export Excel Data with LINQ to XML</title><link>http://blogs.msdn.com/bethmassi/archive/2007/10/30/quickly-import-and-export-excel-data-with-linq-to-xml.aspx#9913028</link><pubDate>Mon, 26 Oct 2009 16:46:31 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:9913028</guid><dc:creator>winsrp</dc:creator><description>&lt;p&gt;there are problems if you have more than one excel sheet in the file, you should include a filter in the where condition.&lt;/p&gt;
&lt;p&gt;Something like &lt;/p&gt;
&lt;p&gt;AndAlso &amp;nbsp;sheet...&amp;lt;Worksheet&amp;gt;.@ss:Name = &amp;quot;Sheet1&amp;quot;&lt;/p&gt;
&lt;p&gt;But the above statement does not works if the sheet1 is the second sheet of the file. since the above is the same as &lt;/p&gt;
&lt;p&gt;AndAlso sheet...&amp;lt;Worksheet&amp;gt;(0).@ss:Name = &amp;quot;Sheet1&amp;quot;&lt;/p&gt;
&lt;p&gt;I'm still trying to figure out how to tell the linq statement to pick only the sheet I want&lt;/p&gt;
</description></item><item><title>re: Quickly Import and Export Excel Data with LINQ to XML</title><link>http://blogs.msdn.com/bethmassi/archive/2007/10/30/quickly-import-and-export-excel-data-with-linq-to-xml.aspx#9914131</link><pubDate>Wed, 28 Oct 2009 15:40:01 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:9914131</guid><dc:creator>Beth Massi</dc:creator><description>&lt;p&gt;Hi winsrp,&lt;/p&gt;
&lt;p&gt;As long as you're importing the XML namespaces above you can change the import code to this and it will select only Sheet1&lt;/p&gt;
&lt;p&gt;Dim book = XDocument.Load(Me.FileName)&lt;/p&gt;
&lt;p&gt;Dim sheet = From s In book...&amp;lt;Worksheet&amp;gt; Where s.@ss:Name = &amp;quot;Sheet1&amp;quot;&lt;/p&gt;
&lt;p&gt;HTH,&lt;/p&gt;
&lt;p&gt;-B&lt;/p&gt;
</description></item></channel></rss>