<?xml version='1.0' encoding='UTF-8'?><?xml-stylesheet href="http://www.blogger.com/styles/atom.css" type="text/css"?><feed xmlns='http://www.w3.org/2005/Atom' xmlns:openSearch='http://a9.com/-/spec/opensearchrss/1.0/' xmlns:georss='http://www.georss.org/georss' xmlns:gd='http://schemas.google.com/g/2005' xmlns:thr='http://purl.org/syndication/thread/1.0'><id>tag:blogger.com,1999:blog-3336773756951433535</id><updated>2011-04-22T11:24:03.105+08:00</updated><category term='.NET'/><title type='text'>xq262144 Ruminations</title><subtitle type='html'>I am a ordinary people and does ordinary things every day, this blog is the meditations of myself on my interesting fields.</subtitle><link rel='http://schemas.google.com/g/2005#feed' type='application/atom+xml' href='http://xq262144.blogspot.com/feeds/posts/default'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3336773756951433535/posts/default?max-results=100'/><link rel='alternate' type='text/html' href='http://xq262144.blogspot.com/'/><link rel='hub' href='http://pubsubhubbub.appspot.com/'/><author><name>xq262144 Ruminations</name><uri>http://www.blogger.com/profile/04101214162653134715</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='http://1.bp.blogspot.com/_n81ndsehxvQ/ScEMxw4-I_I/AAAAAAAAABk/HZqPfI-3wS8/S220/xq262144@gmail.com_2240cf7d.jpg'/></author><generator version='7.00' uri='http://www.blogger.com'>Blogger</generator><openSearch:totalResults>1</openSearch:totalResults><openSearch:startIndex>1</openSearch:startIndex><openSearch:itemsPerPage>100</openSearch:itemsPerPage><entry><id>tag:blogger.com,1999:blog-3336773756951433535.post-7688971493443338482</id><published>2009-03-12T17:48:00.014+08:00</published><updated>2009-03-12T18:49:59.980+08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='.NET'/><title type='text'>The bug of using Office Excel COM component in .NET</title><content type='html'>Thinking of producing a parser to read the information from Excel Document, I chose the Microsoft .NET developing environment and using the Micorosft Office COM component provided by Microsoft Office suite. &lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;When I started the first step of the developing by using the COM component to launch the Excel program and read the basic info. It sucks! The COM component throw an COM exception&lt;span class="Apple-style-span" style="font-style: italic;"&gt;(&lt;/span&gt;&lt;span class="Apple-style-span"   style="  font-weight: bold; font-family:Verdana;font-size:11px;"&gt;&lt;span class="Apple-style-span" style="font-style: italic;"&gt;Com Exception 0x80028018 TYPE_E_INVDATAREAD&lt;/span&gt;&lt;span class="Apple-style-span"   style="  font-weight: normal; font-family:Georgia;font-size:16px;"&gt;&lt;span class="Apple-style-span" style="font-style: italic;"&gt;)&lt;/span&gt; and I cannot work out what is wrong. &lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"   style="  font-weight: bold; font-family:Verdana;font-size:11px;"&gt;&lt;span class="Apple-style-span"   style="  font-weight: normal; font-family:Georgia;font-size:16px;"&gt;So later I used Google to search and find the solution on CodeProject.com, it's about the culture settings of the current .NET program thread.&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;If you meet the same problem, you can fix it like this:&lt;/div&gt;&lt;div&gt;Before launching Excel&lt;/div&gt;&lt;div&gt;&lt;pre class="brush:c-sharp"&gt;System.Globalization.CultureInfo oldCI = System.Threading.Thread.CurrentThread.CurrentCulture;&lt;br /&gt;System.Threading.Thread.CurrentThread.CurrentCulture = new System.Globalization.CultureInfo("en-US");&lt;/pre&gt;&lt;/div&gt;&lt;div&gt;After closing Excel&lt;/div&gt;&lt;div&gt;&lt;pre class="brush:c-sharp"&gt;System.Threading.Thread.CurrentThread.CurrentCulture = oldCI;&lt;/pre&gt;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;&lt;a href="http://www.codeproject.com/KB/office/csharp_excel.aspx?display=PrintAll&amp;amp;fid=23997&amp;amp;df=90&amp;amp;mpp=25&amp;amp;noise=3&amp;amp;sort=Position&amp;amp;view=Quick&amp;amp;select=2727535"&gt;More Info, See it at CodeProject.com&lt;/a&gt;&lt;/div&gt;&lt;div&gt;&lt;a href="http://www.gotdotnet.ru/Forums/Common/290167.aspx"&gt;And More Help at a russian website&lt;/a&gt;&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/3336773756951433535-7688971493443338482?l=xq262144.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://xq262144.blogspot.com/feeds/7688971493443338482/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://xq262144.blogspot.com/2009/03/bug-of-using-office-excel-com-component.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3336773756951433535/posts/default/7688971493443338482'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3336773756951433535/posts/default/7688971493443338482'/><link rel='alternate' type='text/html' href='http://xq262144.blogspot.com/2009/03/bug-of-using-office-excel-com-component.html' title='The bug of using Office Excel COM component in .NET'/><author><name>xq262144 Ruminations</name><uri>http://www.blogger.com/profile/04101214162653134715</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='http://1.bp.blogspot.com/_n81ndsehxvQ/ScEMxw4-I_I/AAAAAAAAABk/HZqPfI-3wS8/S220/xq262144@gmail.com_2240cf7d.jpg'/></author><thr:total>0</thr:total></entry></feed>
