<?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>LuisBE on Services : Excel Services Programmability</title><link>http://blogs.msdn.com/luisbeonservices/archive/tags/Excel+Services+Programmability/default.aspx</link><description>Tags: Excel Services Programmability</description><dc:language>en</dc:language><generator>CommunityServer 2.1 SP1 (Build: 61025.2)</generator><item><title>New MSDN Article on Extending Excel Services Through UDFs</title><link>http://blogs.msdn.com/luisbeonservices/archive/2007/02/06/new-msdn-article-on-extending-excel-services-through-udfs.aspx</link><pubDate>Wed, 07 Feb 2007 00:11:00 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:1613968</guid><dc:creator>LuisBE</dc:creator><slash:comments>1</slash:comments><comments>http://blogs.msdn.com/luisbeonservices/comments/1613968.aspx</comments><wfw:commentRss>http://blogs.msdn.com/luisbeonservices/commentrss.aspx?PostID=1613968</wfw:commentRss><description>From yours truly: Summary: Optimize version 1 of the Excel Services programmability framework to extend Microsoft Office Excel 2007 and Excel Services functionalities to work with SharePoint lists, query tables on Excel Services, external workbook references,...(&lt;a href="http://blogs.msdn.com/luisbeonservices/archive/2007/02/06/new-msdn-article-on-extending-excel-services-through-udfs.aspx"&gt;read more&lt;/a&gt;)&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=1613968" width="1" height="1"&gt;</description><category domain="http://blogs.msdn.com/luisbeonservices/archive/tags/Excel+Services+Programmability/default.aspx">Excel Services Programmability</category></item><item><title>Enable Paging in Your Array Formula UDFs</title><link>http://blogs.msdn.com/luisbeonservices/archive/2007/02/01/enable-paging-in-your-array-formula-udfs.aspx</link><pubDate>Fri, 02 Feb 2007 00:04:00 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:1576214</guid><dc:creator>LuisBE</dc:creator><slash:comments>0</slash:comments><comments>http://blogs.msdn.com/luisbeonservices/comments/1576214.aspx</comments><wfw:commentRss>http://blogs.msdn.com/luisbeonservices/commentrss.aspx?PostID=1576214</wfw:commentRss><description>As I alluded to earlier, one way to overcome the limitation that array formulas do not dynamically resize to fit the dimensionality of the data being returned by your UDF is to use paging. Here is a simple way of enabling paging, without having to modify...(&lt;a href="http://blogs.msdn.com/luisbeonservices/archive/2007/02/01/enable-paging-in-your-array-formula-udfs.aspx"&gt;read more&lt;/a&gt;)&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=1576214" width="1" height="1"&gt;</description><category domain="http://blogs.msdn.com/luisbeonservices/archive/tags/Excel+Services+Programmability/default.aspx">Excel Services Programmability</category></item><item><title>Consuming Business Data Catalog Entities in Excel Services</title><link>http://blogs.msdn.com/luisbeonservices/archive/2007/01/31/consuming-business-data-catalog-entities-in-excel-services.aspx</link><pubDate>Thu, 01 Feb 2007 07:47:00 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:1569827</guid><dc:creator>LuisBE</dc:creator><slash:comments>0</slash:comments><comments>http://blogs.msdn.com/luisbeonservices/comments/1569827.aspx</comments><wfw:commentRss>http://blogs.msdn.com/luisbeonservices/commentrss.aspx?PostID=1569827</wfw:commentRss><description>One of the coolest (only?) SharePoint external data features is the Business Data Catalog (BDC). The BDC is brand new with SharePoint 2007, and is not yet fully integrated into Excel and Excel Services... though, if you've read one or two other entries...(&lt;a href="http://blogs.msdn.com/luisbeonservices/archive/2007/01/31/consuming-business-data-catalog-entities-in-excel-services.aspx"&gt;read more&lt;/a&gt;)&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=1569827" width="1" height="1"&gt;</description><category domain="http://blogs.msdn.com/luisbeonservices/archive/tags/Excel+Services+Programmability/default.aspx">Excel Services Programmability</category></item><item><title>Working Around Dimensional Limitations of Using Array Formulas for UDF Return Values.</title><link>http://blogs.msdn.com/luisbeonservices/archive/2007/01/09/working-around-dimensional-limitations-of-using-array-formulas-for-udf-return-values.aspx</link><pubDate>Tue, 09 Jan 2007 22:42:00 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:1440122</guid><dc:creator>LuisBE</dc:creator><slash:comments>1</slash:comments><comments>http://blogs.msdn.com/luisbeonservices/comments/1440122.aspx</comments><wfw:commentRss>http://blogs.msdn.com/luisbeonservices/commentrss.aspx?PostID=1440122</wfw:commentRss><description>As you have noticed, many of my samples below use an Array Formula in Excel to retrieve an array of data returned by your UDF code. The biggest issue with taking this approach is that you need to know ahead of time the exact dimensions of the data being...(&lt;a href="http://blogs.msdn.com/luisbeonservices/archive/2007/01/09/working-around-dimensional-limitations-of-using-array-formulas-for-udf-return-values.aspx"&gt;read more&lt;/a&gt;)&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=1440122" width="1" height="1"&gt;</description><category domain="http://blogs.msdn.com/luisbeonservices/archive/tags/Excel+Services+Programmability/default.aspx">Excel Services Programmability</category></item><item><title>Using UDFs and Excel Formulas to Get a Query Table on Excel Services</title><link>http://blogs.msdn.com/luisbeonservices/archive/2006/12/11/using-udfs-and-excel-formulas-to-get-a-query-table-on-excel-services.aspx</link><pubDate>Mon, 11 Dec 2006 22:36:00 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:1260729</guid><dc:creator>LuisBE</dc:creator><slash:comments>1</slash:comments><comments>http://blogs.msdn.com/luisbeonservices/comments/1260729.aspx</comments><wfw:commentRss>http://blogs.msdn.com/luisbeonservices/commentrss.aspx?PostID=1260729</wfw:commentRss><description>As you may or may not know by now, one of the limitations in this version of Excel Services is the inability to publish workbooks containing Query Tables (tables that have external data as their source). There have been numerous blog posts on the web...(&lt;a href="http://blogs.msdn.com/luisbeonservices/archive/2006/12/11/using-udfs-and-excel-formulas-to-get-a-query-table-on-excel-services.aspx"&gt;read more&lt;/a&gt;)&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=1260729" width="1" height="1"&gt;</description><enclosure url="http://blogs.msdn.com/luisbeonservices/attachment/1260729.ashx" length="11023" type="application/vnd.openxmlformats-officedocument.spre" /><category domain="http://blogs.msdn.com/luisbeonservices/archive/tags/Excel+Services+Programmability/default.aspx">Excel Services Programmability</category></item><item><title>Refreshing EWA Automatically when Sharepoint Filters are Changed</title><link>http://blogs.msdn.com/luisbeonservices/archive/2006/11/08/refreshing-ewa-automatically-when-sharepoint-filters-are-changed.aspx</link><pubDate>Thu, 09 Nov 2006 09:08:00 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:1042909</guid><dc:creator>LuisBE</dc:creator><slash:comments>8</slash:comments><comments>http://blogs.msdn.com/luisbeonservices/comments/1042909.aspx</comments><wfw:commentRss>http://blogs.msdn.com/luisbeonservices/commentrss.aspx?PostID=1042909</wfw:commentRss><description>If you played around with the post on using UDFs to write to SQL databases, you probably ended up creating a PivotTable connected to the SQL database the UDFs were writing to in order to see the new data showing up on the database. As you would have noticed...(&lt;a href="http://blogs.msdn.com/luisbeonservices/archive/2006/11/08/refreshing-ewa-automatically-when-sharepoint-filters-are-changed.aspx"&gt;read more&lt;/a&gt;)&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=1042909" width="1" height="1"&gt;</description><category domain="http://blogs.msdn.com/luisbeonservices/archive/tags/Excel+Services+Programmability/default.aspx">Excel Services Programmability</category></item><item><title>Using UDFs to Write to SQL Databases from Excel Services</title><link>http://blogs.msdn.com/luisbeonservices/archive/2006/11/08/using-udfs-to-write-to-sql-databases.aspx</link><pubDate>Thu, 09 Nov 2006 08:14:00 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:1042798</guid><dc:creator>LuisBE</dc:creator><slash:comments>4</slash:comments><comments>http://blogs.msdn.com/luisbeonservices/comments/1042798.aspx</comments><wfw:commentRss>http://blogs.msdn.com/luisbeonservices/commentrss.aspx?PostID=1042798</wfw:commentRss><description>There are many reasons why writing straight to a SQL database is a desirable feature on a server. For example, one could imagine a solution where users would load up a workbook on Excel Services, change some parameters, and have that new data saved to...(&lt;a href="http://blogs.msdn.com/luisbeonservices/archive/2006/11/08/using-udfs-to-write-to-sql-databases.aspx"&gt;read more&lt;/a&gt;)&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=1042798" width="1" height="1"&gt;</description><category domain="http://blogs.msdn.com/luisbeonservices/archive/tags/Excel+Services+Programmability/default.aspx">Excel Services Programmability</category></item><item><title>Reloading an EWA Workbook Programmatically.</title><link>http://blogs.msdn.com/luisbeonservices/archive/2006/10/26/reloading-an-ewa-workbook-programmatically.aspx</link><pubDate>Fri, 27 Oct 2006 09:06:00 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:878217</guid><dc:creator>LuisBE</dc:creator><slash:comments>0</slash:comments><comments>http://blogs.msdn.com/luisbeonservices/comments/878217.aspx</comments><wfw:commentRss>http://blogs.msdn.com/luisbeonservices/commentrss.aspx?PostID=878217</wfw:commentRss><description>&lt;P&gt;This will be a quickie.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;I mentioned the EwaGetSessionId(id) function on my earlier post and didn't want to forget the other useful Javascript function we're shipping in the EwrScripts.js file.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;With a simple Javascript function call you can trigger a workbook reload in EWR.&amp;nbsp; All you have to do is call:&lt;/P&gt;
&lt;P&gt;EwaReloadWorkbook(id)&lt;/P&gt;
&lt;P&gt;And pass it the Web Part ID of the ECS web part (you can use the same technique from my earlier post on how to do this).&lt;/P&gt;
&lt;P&gt;&amp;nbsp;Enjoy!&lt;/P&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=878217" width="1" height="1"&gt;</description><category domain="http://blogs.msdn.com/luisbeonservices/archive/tags/Excel+Services+Programmability/default.aspx">Excel Services Programmability</category></item><item><title>Harvesting and Using the Session ID from EWA.</title><link>http://blogs.msdn.com/luisbeonservices/archive/2006/10/26/harvesting-and-using-the-session-id-from-ewa.aspx</link><pubDate>Fri, 27 Oct 2006 08:01:00 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:878203</guid><dc:creator>LuisBE</dc:creator><slash:comments>1</slash:comments><comments>http://blogs.msdn.com/luisbeonservices/comments/878203.aspx</comments><wfw:commentRss>http://blogs.msdn.com/luisbeonservices/commentrss.aspx?PostID=878203</wfw:commentRss><description>&lt;P class=MsoNormal style="MARGIN: 0in 0in 10pt"&gt;Every time you open a workbook in Excel Services you are actually creating your own instance of that workbook.&lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp; &lt;/SPAN&gt;Excel Services keeps track of those instances by assigning them a text string called a session ID.&lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp; &lt;/SPAN&gt;Once a session is created you can perform API calls to that session simply by passing that string into the API call.&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 10pt"&gt;For the greater part of this release it was impossible to determine what session ID was being used by an EWA web part.&lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp; &lt;/SPAN&gt;After some complaining from myself and others, as well as an infrastructure change due to other issues this is now possible.&lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp; &lt;/SPAN&gt;Excel Services now provides a Javascript function that will return the session ID corresponding to the web part ID passed in.&lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp; &lt;/SPAN&gt;Here’s the signature:&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 10pt"&gt;EwaGetSessionId(id)&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 10pt"&gt;Where id is a text string corresponding to the web part ID for the Excel Services web part (you can get this programmatically or by looking at the source of a web part page containing an EWA part, and searching for ECSFrame.&lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp; &lt;/SPAN&gt;The ID will be of the form “WebPartWPQ#” where # will be 1, 2, 3…). &lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 10pt" mce_keep="true"&gt;&amp;nbsp;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 10pt"&gt;&lt;SPAN style="FONT-SIZE: 14pt"&gt;Show Me:&lt;?xml:namespace prefix = o ns = "urn:schemas-microsoft-com:office:office" /&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 10pt"&gt;One useful thing to do with the session ID would be to pass it to the EWA web part through a parameter, so that it can be referenced from within the workbook, or even used in a call to a User Defined Function.&lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp; &lt;/SPAN&gt;You can see where this would be useful in creating a session management workbook, user tracking, or to enable your UDFs to make API calls that affect the current, or other live sessions.&lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp; &lt;/SPAN&gt;&lt;B&gt;NOTE: &lt;/B&gt;Changing sessions being used in EWA through API calls can be troublesome, as sessions are not re-entrant and EWA will return an error if it attempts to access session information while an API call is currently using that session.&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 10pt"&gt;Below I will show you how to harvest the session ID from an EWA part, and pass it into an Excel workbook through a parameter.&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 10pt" mce_keep="true"&gt;&amp;nbsp;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 10pt"&gt;&lt;SPAN style="FONT-SIZE: 14pt"&gt;Example:&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 10pt"&gt;First you will need to create a web part or dashboard page with the following Sharepoint web parts:&lt;/P&gt;
&lt;P class=MsoListParagraphCxSpFirst style="MARGIN: 0in 0in 0pt 0.5in; TEXT-INDENT: -0.25in; mso-list: l0 level1 lfo1"&gt;&lt;SPAN style="mso-bidi-font-family: Calibri; mso-bidi-theme-font: minor-latin"&gt;&lt;SPAN style="mso-list: Ignore"&gt;1.&lt;SPAN style="FONT: 7pt 'Times New Roman'"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;SPAN dir=ltr&gt;&lt;/SPAN&gt;Excel Web Access&lt;/P&gt;
&lt;P class=MsoListParagraphCxSpMiddle style="MARGIN: 0in 0in 0pt 0.5in; TEXT-INDENT: -0.25in; mso-list: l0 level1 lfo1"&gt;&lt;SPAN style="mso-bidi-font-family: Calibri; mso-bidi-theme-font: minor-latin"&gt;&lt;SPAN style="mso-list: Ignore"&gt;2.&lt;SPAN style="FONT: 7pt 'Times New Roman'"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;SPAN dir=ltr&gt;&lt;/SPAN&gt;Text Filter&lt;/P&gt;
&lt;P class=MsoListParagraphCxSpMiddle style="MARGIN: 0in 0in 0pt 0.5in; TEXT-INDENT: -0.25in; mso-list: l0 level1 lfo1"&gt;&lt;SPAN style="mso-bidi-font-family: Calibri; mso-bidi-theme-font: minor-latin"&gt;&lt;SPAN style="mso-list: Ignore"&gt;3.&lt;SPAN style="FONT: 7pt 'Times New Roman'"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;SPAN dir=ltr&gt;&lt;/SPAN&gt;Filter Actions&lt;/P&gt;
&lt;P class=MsoListParagraphCxSpLast style="MARGIN: 0in 0in 10pt 0.5in; TEXT-INDENT: -0.25in; mso-list: l0 level1 lfo1"&gt;&lt;SPAN style="mso-bidi-font-family: Calibri; mso-bidi-theme-font: minor-latin"&gt;&lt;SPAN style="mso-list: Ignore"&gt;4.&lt;SPAN style="FONT: 7pt 'Times New Roman'"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;SPAN dir=ltr&gt;&lt;/SPAN&gt;Content Editor (This one should be below all other web parts, as it will contain Javascript that will reference the parts created above)&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 10pt"&gt;Once you publish this page you will need to get the following information from the page’s source (right click in IE and View Source).&lt;/P&gt;
&lt;P class=MsoListParagraphCxSpFirst style="MARGIN: 0in 0in 0pt 0.5in; TEXT-INDENT: -0.25in; mso-list: l1 level1 lfo2"&gt;&lt;SPAN style="mso-bidi-font-family: Calibri; mso-bidi-theme-font: minor-latin"&gt;&lt;SPAN style="mso-list: Ignore"&gt;1.&lt;SPAN style="FONT: 7pt 'Times New Roman'"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;SPAN dir=ltr&gt;&lt;/SPAN&gt;ECS Web Part ID – Search for “ECSFrame” in the source and get the corresponding “WebPartWPQ#”.&lt;/P&gt;
&lt;P class=MsoListParagraphCxSpMiddle style="MARGIN: 0in 0in 0pt 0.5in; TEXT-INDENT: -0.25in; mso-list: l1 level1 lfo2"&gt;&lt;SPAN style="mso-bidi-font-family: Calibri; mso-bidi-theme-font: minor-latin"&gt;&lt;SPAN style="mso-list: Ignore"&gt;2.&lt;SPAN style="FONT: 7pt 'Times New Roman'"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;SPAN dir=ltr&gt;&lt;/SPAN&gt;Text Filter Web Part ID – Same as above, but search for “TextSlicer”.&lt;/P&gt;
&lt;P class=MsoListParagraphCxSpLast style="MARGIN: 0in 0in 10pt 0.5in; TEXT-INDENT: -0.25in; mso-list: l1 level1 lfo2"&gt;&lt;SPAN style="mso-bidi-font-family: Calibri; mso-bidi-theme-font: minor-latin"&gt;&lt;SPAN style="mso-list: Ignore"&gt;3.&lt;SPAN style="FONT: 7pt 'Times New Roman'"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;SPAN dir=ltr&gt;&lt;/SPAN&gt;Filter Actions Web Part ID – Same as above, but search for “Apply Filters”.&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 10pt"&gt;Now that you have the values for the above ID’s you can create a text file which will contain your Javascript.&lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp; &lt;/SPAN&gt;Here’s what I have (replace the IDs under “DEFINE WEB PART NAMES” with the values you got from above):&lt;/P&gt;
&lt;P class=Code style="MARGIN: 0in 0in 0pt"&gt;&amp;lt;script type='text/javascript' language='javascript''text/javascript'&amp;gt;&lt;/P&gt;
&lt;P class=Code style="MARGIN: 0in 0in 0pt"&gt;&lt;SPAN style="COLOR: #0070c0"&gt;function&lt;/SPAN&gt; setSession(sessionId)&lt;/P&gt;
&lt;P class=Code style="MARGIN: 0in 0in 0pt"&gt;{&lt;/P&gt;
&lt;P class=Code style="MARGIN: 0in 0in 0pt"&gt;&lt;SPAN style="mso-tab-count: 1"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&lt;SPAN style="COLOR: #0070c0"&gt;if&lt;/SPAN&gt;(sessionId == &lt;SPAN style="COLOR: #0070c0"&gt;null&lt;/SPAN&gt;)&lt;/P&gt;
&lt;P class=Code style="MARGIN: 0in 0in 0pt"&gt;&lt;SPAN style="mso-tab-count: 1"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;{&lt;/P&gt;
&lt;P class=Code style="MARGIN: 0in 0in 0pt"&gt;&lt;SPAN style="mso-tab-count: 2"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&lt;SPAN style="COLOR: #00b050"&gt;&amp;lt;!-- Session not ready yet.&lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp; &lt;/SPAN&gt;Try again in 1 second --&amp;gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=Code style="MARGIN: 0in 0in 0pt"&gt;&lt;SPAN style="mso-tab-count: 2"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;setTimeout('setSession(EwaGetSessionId(ECSWebPartID))', 1000);&lt;/P&gt;
&lt;P class=Code style="MARGIN: 0in 0in 0pt"&gt;&lt;SPAN style="mso-tab-count: 1"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;}&lt;/P&gt;
&lt;P class=Code style="MARGIN: 0in 0in 0pt"&gt;&lt;SPAN style="mso-tab-count: 1"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&lt;SPAN style="COLOR: #0070c0"&gt;else&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=Code style="MARGIN: 0in 0in 0pt"&gt;&lt;SPAN style="mso-tab-count: 1"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;{&lt;/P&gt;
&lt;P class=Code style="MARGIN: 0in 0in 0pt"&gt;&lt;SPAN style="mso-tab-count: 2"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&lt;SPAN style="COLOR: #00b050"&gt;&amp;lt;!-- Set up real Text Filter ID --&amp;gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=Code style="MARGIN: 0in 0in 0pt"&gt;&lt;SPAN style="mso-tab-count: 2"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&lt;SPAN style="COLOR: #0070c0"&gt;var&lt;/SPAN&gt;&lt;SPAN lang=PT-BR style="mso-ansi-language: PT-BR"&gt; filterId = &lt;SPAN style="COLOR: #c00000"&gt;'ctl00$m$g_'&lt;/SPAN&gt; + &lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=Code style="MARGIN: 0in 0in 0pt"&gt;&lt;SPAN lang=PT-BR style="mso-ansi-language: PT-BR"&gt;&lt;SPAN style="mso-tab-count: 3"&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; &lt;/SPAN&gt;&lt;SPAN style="mso-tab-count: 1"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&lt;/SPAN&gt;document.getElementById(TextSlicerWebPartID).WebPartID.replace(/-/g, &lt;SPAN lang=PT-BR style="COLOR: #c00000; mso-ansi-language: PT-BR"&gt;"_"&lt;/SPAN&gt;) + &lt;/P&gt;
&lt;P class=Code style="MARGIN: 0in 0in 0pt"&gt;&lt;SPAN style="mso-tab-count: 4"&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; &lt;/SPAN&gt;&lt;SPAN lang=PT-BR style="COLOR: #c00000; mso-ansi-language: PT-BR"&gt;'$SPTextSlicerValueTextControl'&lt;/SPAN&gt;;&lt;/P&gt;
&lt;P class=Code style="MARGIN: 0in 0in 0pt"&gt;&lt;o:p&gt;&amp;nbsp;&lt;/o:p&gt;&lt;/P&gt;
&lt;P class=Code style="MARGIN: 0in 0in 0pt"&gt;&lt;SPAN style="mso-tab-count: 2"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&lt;SPAN style="COLOR: #00b050"&gt;&amp;lt;!-- If the Text Filter doesn't already have the current session ID, set it --&amp;gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=Code style="MARGIN: 0in 0in 0pt"&gt;&lt;SPAN style="mso-tab-count: 2"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&lt;SPAN style="COLOR: #0070c0"&gt;if&lt;/SPAN&gt;(sessionId != document.getElementById(filterId).value)&lt;/P&gt;
&lt;P class=Code style="MARGIN: 0in 0in 0pt"&gt;&lt;SPAN style="mso-tab-count: 2"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;{&lt;/P&gt;
&lt;P class=Code style="MARGIN: 0in 0in 0pt"&gt;&lt;SPAN style="mso-tab-count: 3"&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; &lt;/SPAN&gt;document.getElementById(filterId).value = sessionId;&lt;/P&gt;
&lt;P class=Code style="MARGIN: 0in 0in 0pt"&gt;&lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=Code style="MARGIN: 0in 0in 0pt"&gt;&lt;SPAN style="mso-tab-count: 3"&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; &lt;/SPAN&gt;&lt;SPAN style="COLOR: #00b050"&gt;&amp;lt;!-- Set up function call Filter Action would make if clicked --&amp;gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=Code style="MARGIN: 0in 0in 0pt"&gt;&lt;SPAN style="mso-tab-count: 3"&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; &lt;/SPAN&gt;&lt;SPAN style="COLOR: #0070c0"&gt;var&lt;/SPAN&gt; actionId = &lt;SPAN lang=PT-BR style="COLOR: #c00000; mso-ansi-language: PT-BR"&gt;'ctl00_m_g_'&lt;/SPAN&gt; + &lt;/P&gt;
&lt;P class=Code style="MARGIN: 0in 0in 0pt"&gt;&lt;SPAN style="mso-tab-count: 4"&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; &lt;/SPAN&gt;&lt;SPAN style="mso-tab-count: 1"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;document.getElementById(FilterActionsWebPartID).WebPartID.replace(/-/g, &lt;SPAN lang=PT-BR style="COLOR: #c00000; mso-ansi-language: PT-BR"&gt;"_"&lt;/SPAN&gt;) + &lt;/P&gt;
&lt;P class=Code style="MARGIN: 0in 0in 0pt"&gt;&lt;SPAN style="mso-tab-count: 5"&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; &lt;/SPAN&gt;&lt;SPAN lang=PT-BR style="COLOR: #c00000; mso-ansi-language: PT-BR"&gt;'_PostBack(this)'&lt;/SPAN&gt;;&lt;/P&gt;
&lt;P class=Code style="MARGIN: 0in 0in 0pt"&gt;&lt;o:p&gt;&amp;nbsp;&lt;/o:p&gt;&lt;/P&gt;
&lt;P class=Code style="MARGIN: 0in 0in 0pt"&gt;&lt;SPAN style="mso-tab-count: 3"&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; &lt;/SPAN&gt;&lt;SPAN style="COLOR: #00b050"&gt;&amp;lt;!-- Send text filter value to EWR parameter through Filter Actions --&amp;gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=Code style="MARGIN: 0in 0in 0pt"&gt;&lt;SPAN style="mso-tab-count: 3"&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; &lt;/SPAN&gt;setTimeout(actionId,0);&lt;/P&gt;
&lt;P class=Code style="MARGIN: 0in 0in 0pt"&gt;&lt;SPAN style="mso-tab-count: 2"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;}&lt;/P&gt;
&lt;P class=Code style="MARGIN: 0in 0in 0pt"&gt;&lt;SPAN style="mso-tab-count: 1"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;}&lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=Code style="MARGIN: 0in 0in 0pt"&gt;} &lt;/P&gt;
&lt;P class=Code style="MARGIN: 0in 0in 0pt"&gt;&lt;SPAN style="COLOR: #00b050"&gt;&amp;lt;!-- DEFINE WEB PART NAMES --&amp;gt;&lt;/SPAN&gt; &lt;/P&gt;
&lt;P class=Code style="MARGIN: 0in 0in 0pt"&gt;&lt;SPAN style="COLOR: #0070c0"&gt;var&lt;/SPAN&gt; ECSWebPartID = 'WebPartWPQ3';&lt;/P&gt;
&lt;P class=Code style="MARGIN: 0in 0in 0pt"&gt;&lt;SPAN style="COLOR: #0070c0"&gt;var&lt;/SPAN&gt; TextSlicerWebPartID = 'WebPartWPQ5';&lt;/P&gt;
&lt;P class=Code style="MARGIN: 0in 0in 0pt"&gt;&lt;SPAN style="COLOR: #0070c0"&gt;var&lt;/SPAN&gt; FilterActionsWebPartID = 'WebPartWPQ4';&lt;/P&gt;
&lt;P class=Code style="MARGIN: 0in 0in 0pt"&gt;&lt;o:p&gt;&amp;nbsp;&lt;/o:p&gt;&lt;/P&gt;
&lt;P class=Code style="MARGIN: 0in 0in 0pt"&gt;&lt;SPAN style="COLOR: #00b050"&gt;&amp;lt;!-- In 1 second, check to see if we have a session --&amp;gt;&lt;/SPAN&gt; &lt;/P&gt;
&lt;P class=Code style="MARGIN: 0in 0in 0pt"&gt;setTimeout('setSession(EwaGetSessionId(ECSWebPartID))', 1000);&lt;/P&gt;
&lt;P class=Code style="MARGIN: 0in 0in 0pt"&gt;&amp;lt;/script&amp;gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 10pt"&gt;&lt;o:p&gt;&amp;nbsp;&lt;/o:p&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 10pt"&gt;Now save this text file to a Sharepoint document library and remember the path to it (e.g. &lt;A href="http://myserver/Documents/Scripts.txt" mce_href="http://myserver/Documents/Scripts.txt"&gt;http://MYSERVER/Documents/Scripts.txt&lt;/A&gt;).&lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp; &lt;/SPAN&gt;On your web part or dashboard page modify the Content Editor web part such that it’s Content Link points to your script file above.&lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp; &lt;/SPAN&gt;That script will now run every time the page is loaded.&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 10pt"&gt;Load a workbook in your EWA web part with a parameter defined, and connect the Text Filter web part to send it’s value to EWA’s parameter.&lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp; &lt;/SPAN&gt;If you like, you can also minimize the Filter Actions and Text Filter web parts to get them out of the way.&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 10pt"&gt;&lt;B&gt;You’re DONE!!!&lt;o:p&gt;&lt;/o:p&gt;&lt;/B&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 10pt"&gt;Now, every time you load this page the Javascript above will run, and once it successfully harvests the session ID from EWA it will stuff it into the Text Filter web part and call the Filter Actions function to pass it along to EWA.&lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp; &lt;/SPAN&gt;You should see your session ID in the workbook cell defined as the parameter.&lt;/P&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=878203" width="1" height="1"&gt;</description><category domain="http://blogs.msdn.com/luisbeonservices/archive/tags/Excel+Services+Programmability/default.aspx">Excel Services Programmability</category></item><item><title>Customizing EWA in the XLViewer.aspx Page</title><link>http://blogs.msdn.com/luisbeonservices/archive/2006/10/19/customizing-ewa-in-xlviewer-aspx.aspx</link><pubDate>Thu, 19 Oct 2006 11:54:00 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:843159</guid><dc:creator>LuisBE</dc:creator><slash:comments>4</slash:comments><comments>http://blogs.msdn.com/luisbeonservices/comments/843159.aspx</comments><wfw:commentRss>http://blogs.msdn.com/luisbeonservices/commentrss.aspx?PostID=843159</wfw:commentRss><description>&lt;P mce_keep="true"&gt;As you may have noticed if you have started to play around with Excel Services, the XLViewer.aspx page is the leanest way to open up a workbook on the server.&amp;nbsp; There is very little Sharepoint UI added to this page and you are basically given a full screen Excel Web Access web part.&lt;/P&gt;
&lt;P&gt;The biggest drawbacks of the XLViewer.aspx page are the lack of support for adding other web parts and connecting filter web parts, and the lack of customizability of the EWA properties.&lt;/P&gt;
&lt;P&gt;This post will teach you how to get around the second drawback, and enable you to customize the EWA web part in XLViewer.aspx simply by sending it the query string parameters to be used.&lt;/P&gt;&lt;B&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt"&gt;&lt;B style="mso-bidi-font-weight: normal"&gt;&lt;SPAN style="FONT-SIZE: 16pt"&gt;&lt;FONT face="Times New Roman"&gt;&lt;/FONT&gt;&lt;/SPAN&gt;&lt;/B&gt;&amp;nbsp;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt"&gt;&lt;B style="mso-bidi-font-weight: normal"&gt;&lt;SPAN style="FONT-SIZE: 16pt"&gt;&lt;FONT face="Times New Roman"&gt;How:&lt;?xml:namespace prefix = o ns = "urn:schemas-microsoft-com:office:office" /&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/FONT&gt;&lt;/SPAN&gt;&lt;/B&gt;&lt;/P&gt;&lt;/B&gt;
&lt;P&gt;The coding here is actually pretty simple, and will enable you to do things like loading XLViewer.aspx in an IFRAME and specifying how many columns or rows to display, or whether or not to display the navigation toolbar.&amp;nbsp; On a later date I will even show you how to create a Live.com gadget that will embed this page on &lt;A href="http://www.live.com/" mce_href="http://www.live.com/"&gt;http://www.live.com/&lt;/A&gt;. &lt;/P&gt;
&lt;P&gt;The first thing you need to do is create a copy of XLViewer.aspx which is located in C:\Program Files\Common Files\Microsoft Shared\web server extensions\12\TEMPLATE\LAYOUTS (your mileage may vary).&amp;nbsp; I named my copy MyXLViewer.aspx.&amp;nbsp; You can now access this by going to &lt;A href="http://servername/_layouts/MyXLViewer.aspx" mce_href="http://servername/_layouts/MyXLViewer.aspx"&gt;http://SERVERNAME/_layouts/MyXLViewer.aspx&lt;/A&gt;, but obviously it won't be doing anything special just yet.&lt;/P&gt;
&lt;P&gt;The next step is to open MyXLViewer.aspx in Notepad or any other text editor.&amp;nbsp; Our goal here is to modify the Page_Load() event such that when the page loads we will set the properties passed in through the query string directly into the EWA web part object.&lt;/P&gt;
&lt;P&gt;To accomplish this we first need to enable events on this page.&amp;nbsp; You can do this by changing the 4th line on the page from reading:&lt;/P&gt;&amp;lt;%@ Page language="C#" Codebehind="XlViewer.aspx.cs" AutoEventWireup="&lt;SPAN style="FONT-SIZE: 12pt; COLOR: red; FONT-FAMILY: 'Times New Roman','serif'; mso-ansi-language: EN-US; mso-fareast-font-family: 'Times New Roman'; mso-fareast-language: EN-US; mso-bidi-language: AR-SA"&gt;false&lt;/SPAN&gt;"...&lt;BR&gt;To read:&lt;BR&gt;&amp;lt;%@ Page language="C#" Codebehind="XlViewer.aspx.cs" AutoEventWireup="&lt;SPAN style="FONT-SIZE: 12pt; COLOR: red; FONT-FAMILY: 'Times New Roman','serif'; mso-ansi-language: EN-US; mso-fareast-font-family: 'Times New Roman'; mso-fareast-language: EN-US; mso-bidi-language: AR-SA"&gt;true&lt;/SPAN&gt;"...&lt;BR&gt;&lt;BR&gt;
&lt;P&gt;Congratulations!&amp;nbsp; You have now enabled us to handle events in the page.&amp;nbsp; The next thing we need is a little bit of code to parse the query string for the properties we want, and stuff them into the EWA web part object so that it does what we tell it to do.&lt;/P&gt;
&lt;P&gt;Here's the code you want to place just before the &amp;lt;/HEAD&amp;gt; tag on the page:&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt"&gt;&lt;FONT face="Times New Roman" size=3&gt;&amp;lt;script runat="server"&amp;gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt"&gt;&lt;FONT size=3&gt;&lt;FONT face="Times New Roman"&gt;&lt;SPAN style="COLOR: blue"&gt;private&lt;/SPAN&gt;&lt;SPAN style="COLOR: #3333ff"&gt; &lt;/SPAN&gt;&lt;SPAN style="COLOR: blue"&gt;void&lt;/SPAN&gt; Page_Load(&lt;SPAN style="COLOR: blue"&gt;object&lt;/SPAN&gt; sender, System.&lt;SPAN style="COLOR: #31849b; mso-themecolor: accent5; mso-themeshade: 191"&gt;EventArgs&lt;/SPAN&gt; e)&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt"&gt;&lt;FONT face="Times New Roman" size=3&gt;{&lt;/FONT&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt"&gt;&lt;FONT size=3&gt;&lt;FONT face="Times New Roman"&gt;&lt;SPAN style="mso-tab-count: 1"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&lt;SPAN style="COLOR: blue"&gt;if&lt;/SPAN&gt; (Request.QueryString["RowsToDisplay"] != &lt;SPAN style="COLOR: blue"&gt;null&lt;/SPAN&gt;)&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt"&gt;&lt;FONT size=3&gt;&lt;FONT face="Times New Roman"&gt;&lt;SPAN style="mso-tab-count: 2"&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; &lt;/SPAN&gt;m_excelWebRenderer.RowsToDisplay =&lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp; &lt;/SPAN&gt;&lt;SPAN style="mso-tab-count: 1"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt"&gt;&lt;FONT size=3&gt;&lt;FONT face="Times New Roman"&gt;&lt;SPAN style="mso-tab-count: 3"&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;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&lt;SPAN style="COLOR: #31849b; mso-themecolor: accent5; mso-themeshade: 191"&gt;Int32&lt;/SPAN&gt;.Parse(Request.QueryString["RowsToDisplay"]);&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt"&gt;&lt;o:p&gt;&lt;FONT face="Times New Roman" size=3&gt;&amp;nbsp;&lt;/FONT&gt;&lt;/o:p&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt"&gt;&lt;FONT size=3&gt;&lt;FONT face="Times New Roman"&gt;&lt;SPAN style="mso-tab-count: 1"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&lt;SPAN style="COLOR: blue"&gt;if&lt;/SPAN&gt; (Request.QueryString["ColumnsToDisplay"] != &lt;SPAN style="COLOR: blue"&gt;null&lt;/SPAN&gt;)&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt"&gt;&lt;FONT size=3&gt;&lt;FONT face="Times New Roman"&gt;&lt;SPAN style="mso-tab-count: 2"&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; &lt;/SPAN&gt;m_excelWebRenderer.ColumnsToDisplay =&lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp; &lt;/SPAN&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt"&gt;&lt;FONT size=3&gt;&lt;FONT face="Times New Roman"&gt;&lt;SPAN style="mso-tab-count: 3"&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;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&lt;SPAN style="COLOR: #31849b; mso-themecolor: accent5; mso-themeshade: 191"&gt;Int32&lt;/SPAN&gt;.Parse(Request.QueryString["ColumnsToDisplay"]);&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt"&gt;&lt;SPAN style="mso-spacerun: yes"&gt;&lt;FONT face="Times New Roman" size=3&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; &lt;/FONT&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt"&gt;&lt;FONT size=3&gt;&lt;FONT face="Times New Roman"&gt;&lt;SPAN style="mso-tab-count: 1"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&lt;SPAN style="COLOR: blue"&gt;if&lt;/SPAN&gt; (Request.QueryString["ToolbarVisibilityStyle"] != &lt;SPAN style="COLOR: blue"&gt;null&lt;/SPAN&gt;)&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt"&gt;&lt;FONT size=3&gt;&lt;FONT face="Times New Roman"&gt;&lt;SPAN style="mso-tab-count: 2"&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; &lt;/SPAN&gt;&lt;SPAN style="COLOR: blue"&gt;if&lt;/SPAN&gt; (Request.QueryString["ToolbarVisibilityStyle"] == "1")&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt"&gt;&lt;FONT size=3&gt;&lt;FONT face="Times New Roman"&gt;&lt;SPAN style="mso-tab-count: 3"&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;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;m_excelWebRenderer.ToolbarStyle =&lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp; &lt;/SPAN&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt"&gt;&lt;FONT size=3&gt;&lt;FONT face="Times New Roman"&gt;&lt;SPAN style="mso-spacerun: yes"&gt;&lt;/SPAN&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;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; ToolbarVisibilityStyle.FullToolbar;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt"&gt;&lt;FONT size=3&gt;&lt;FONT face="Times New Roman"&gt;&lt;SPAN style="mso-tab-count: 2"&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; &lt;/SPAN&gt;&lt;SPAN style="COLOR: blue"&gt;else&lt;/SPAN&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt"&gt;&lt;FONT size=3&gt;&lt;FONT face="Times New Roman"&gt;&lt;SPAN style="mso-tab-count: 3"&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;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;m_excelWebRenderer.ToolbarStyle = &lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt"&gt;&lt;FONT size=3&gt;&lt;FONT face="Times New Roman"&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;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;ToolbarVisibilityStyle.None;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt"&gt;&lt;FONT face="Times New Roman" size=3&gt;}&lt;/FONT&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt"&gt;&lt;FONT face="Times New Roman" size=3&gt;&amp;lt;/script&amp;gt;&lt;/FONT&gt;&lt;/P&gt;&lt;BR&gt;
&lt;P&gt;The code above will add support for 3 query string parameters, namely: RowsToDisplay, ColumnsToDisplay, and ToolbarVisibilityStyle.&amp;nbsp; You use these parameters simply by appending them to the query string, so if you want to load &lt;A href="http://servername/Documents/Book1.xlsx" mce_href="http://servername/Documents/Book1.xlsx"&gt;http://SERVERNAME/Documents/Book1.xlsx&lt;/A&gt; &amp;nbsp;showing 5 columns, 10 rows, but no Toolbar you would browse to &lt;A href="http://servername/_layouts/MyXLViewer.aspx? id=http://SERVERNAME/Documents/Book1.xlsx &amp;amp;RowsToDisplay=10&amp;amp;ColumnsToDisplay=5&amp;amp;ToolbarVisibilityStyle=0" mce_href="http://servername/_layouts/MyXLViewer.aspx?id=http://SERVERNAME/Documents/Book1.xlsx&amp;amp;RowsToDisplay=10&amp;amp;ColumnsToDisplay=5&amp;amp;ToolbarVisibilityStyle=0"&gt;http://SERVERNAME/_layouts/MyXLViewer.aspx? id=http://SERVERNAME/Documents/Book1.xlsx &amp;amp;RowsToDisplay=10&amp;amp;ColumnsToDisplay=5&amp;amp;ToolbarVisibilityStyle=0&lt;/A&gt; &lt;/P&gt;
&lt;P&gt;That's all!&amp;nbsp; I told you it would be simple.&amp;nbsp; Using this same method you can customize any of the Excel Web Access web part properties just by adding them to the Page_Load event as I have shown above.&amp;nbsp; In order to figure out all of the variable names and types for the properties we provide you can open up an existing EWA web part page, click on Modify Web Part drop down and choose Export.&amp;nbsp; You can save the *.webpart file anywhere and open it on Notepad.&amp;nbsp; Here's what I'm seeing on our current builds:&lt;/P&gt;
&lt;P&gt;&amp;lt;properties&amp;gt;&lt;BR&gt;&amp;lt;property name="Height" type="string" /&amp;gt;&lt;BR&gt;&amp;lt;property name="HelpMode" type="helpmode"&amp;gt;Modeless&amp;lt;/property&amp;gt;&lt;BR&gt;&amp;lt;property name="CatalogIconImageUrl" type="string"&amp;gt;/_layouts/images/ewr023.gif&amp;lt;/property&amp;gt;&lt;BR&gt;&amp;lt;property name="AutomaticPeriodicDataRefresh" Type="Microsoft.Office.Excel.WebUI.AutomaticPeriodicDataRefreshMode, Microsoft.Office.Excel.WebUI, Version=12.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c"&amp;gt;Disabled&amp;lt;/property&amp;gt;&lt;BR&gt;&amp;lt;property name="ColumnsToDisplay" type="int"&amp;gt;20&amp;lt;/property&amp;gt;&lt;BR&gt;&amp;lt;property name="Description" type="string"&amp;gt;&amp;lt;/property&amp;gt;&lt;BR&gt;&amp;lt;property name="ShowVisibleItemButton" type="bool"&amp;gt;True&amp;lt;/property&amp;gt;&lt;BR&gt;&amp;lt;property name="Direction" type="direction"&amp;gt;NotSet&amp;lt;/property&amp;gt;&lt;BR&gt;&amp;lt;property name="MissingAssembly" type="string"&amp;gt;&amp;lt;/property&amp;gt;&lt;BR&gt;&amp;lt;property name="Width" type="string" /&amp;gt;&lt;BR&gt;&amp;lt;property name="AllowConnect" type="bool"&amp;gt;True&amp;lt;/property&amp;gt;&lt;BR&gt;&amp;lt;property name="AllowSorting" type="bool"&amp;gt;True&amp;lt;/property&amp;gt;&lt;BR&gt;&amp;lt;property name="AllowHyperlinks" type="bool"&amp;gt;True&amp;lt;/property&amp;gt;&lt;BR&gt;&amp;lt;property name="TitleUrl" type="string" /&amp;gt;&lt;BR&gt;&amp;lt;property name="AllowEdit" type="bool"&amp;gt;True&amp;lt;/property&amp;gt;&lt;BR&gt;&amp;lt;property name="RowsToDisplay" type="int"&amp;gt;75&amp;lt;/property&amp;gt;&lt;BR&gt;&amp;lt;property name="ShowWorkbookParameters" type="bool"&amp;gt;True&amp;lt;/property&amp;gt;&lt;BR&gt;&amp;lt;property name="CloseWorkbookSessions" type="bool"&amp;gt;False&amp;lt;/property&amp;gt;&lt;BR&gt;&amp;lt;property name="WorkbookUri" type="string" /&amp;gt;&lt;BR&gt;&amp;lt;property name="ChromeType" type="chrometype"&amp;gt;TitleOnly&amp;lt;/property&amp;gt;&lt;BR&gt;&amp;lt;property name="ChromeState" type="chromestate"&amp;gt;Normal&amp;lt;/property&amp;gt;&lt;BR&gt;&amp;lt;property name="AllowPivotSpecificOperations" type="bool"&amp;gt;True&amp;lt;/property&amp;gt;&lt;BR&gt;&amp;lt;property name="AutoGenerateTitle" type="bool"&amp;gt;True&amp;lt;/property&amp;gt;&lt;BR&gt;&amp;lt;property name="AllowFiltering" type="bool"&amp;gt;True&amp;lt;/property&amp;gt;&lt;BR&gt;&amp;lt;property name="VisibleItem" type="string" /&amp;gt;&lt;BR&gt;&amp;lt;property name="AllowInExcelOperations" type="bool"&amp;gt;True&amp;lt;/property&amp;gt;&lt;BR&gt;&amp;lt;property name="AllowNavigation" type="bool"&amp;gt;True&amp;lt;/property&amp;gt;&lt;BR&gt;&amp;lt;property name="ExportMode" type="exportmode"&amp;gt;All&amp;lt;/property&amp;gt;&lt;BR&gt;&amp;lt;property name="ToolbarStyle" type="Microsoft.Office.Excel.WebUI.ToolbarVisibilityStyle, Microsoft.Office.Excel.WebUI, Version=12.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c"&amp;gt;FullToolbar&amp;lt;/property&amp;gt;&lt;BR&gt;&amp;lt;property name="AllowInteractivity" type="bool"&amp;gt;True&amp;lt;/property&amp;gt;&lt;BR&gt;&amp;lt;property name="HelpUrl" type="string" /&amp;gt;&lt;BR&gt;&amp;lt;property name="AllowPeriodicDataRefresh" type="bool"&amp;gt;True&amp;lt;/property&amp;gt;&lt;BR&gt;&amp;lt;property name="AllowClose" type="bool"&amp;gt;True&amp;lt;/property&amp;gt;&lt;BR&gt;&amp;lt;property name="Hidden" type="bool"&amp;gt;False&amp;lt;/property&amp;gt;&lt;BR&gt;&amp;lt;property name="TitleIconImageUrl" type="string"&amp;gt;/_layouts/images/ewr023.gif&amp;lt;/property&amp;gt;&lt;BR&gt;&amp;lt;property name="AllowManualDataRefresh" type="bool"&amp;gt;True&amp;lt;/property&amp;gt;&lt;BR&gt;&amp;lt;property name="AllowHide" type="bool"&amp;gt;True&amp;lt;/property&amp;gt;&lt;BR&gt;&amp;lt;property name="AllowZoneChange" type="bool"&amp;gt;True&amp;lt;/property&amp;gt;&lt;BR&gt;&amp;lt;property name="AutoGenerateDetailLink" type="bool"&amp;gt;True&amp;lt;/property&amp;gt;&lt;BR&gt;&amp;lt;property name="AllowRecalculation" type="bool"&amp;gt;True&amp;lt;/property&amp;gt;&lt;BR&gt;&amp;lt;property name="Title" type="string"&amp;gt;Excel Web Access&amp;lt;/property&amp;gt;&lt;BR&gt;&amp;lt;property name="AllowParameterModification" type="bool"&amp;gt;True&amp;lt;/property&amp;gt;&lt;BR&gt;&amp;lt;property name="AllowMinimize" type="bool"&amp;gt;True&amp;lt;/property&amp;gt;&lt;BR&gt;&amp;lt;/properties&amp;gt;&lt;/P&gt;
&lt;P&gt;&lt;STRONG&gt;NOTE: &lt;/STRONG&gt;The list above is only there for you to be able to get the "property name" for everything we support in the Excel Web Renderer object, and the "type" it maps to.&amp;nbsp; For example, if you wanted to set this particular property from the list above:&lt;/P&gt;
&lt;P&gt;&amp;lt;property name="AllowMinimize" type="bool"&amp;gt;True&amp;lt;/property&amp;gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;You would simply add code to the Page_Load() handler to do this:&lt;/P&gt;
&lt;P&gt;m_excelWebRenderer.AllowMinimize = true;&amp;nbsp;&amp;nbsp; // or false if you want since type is bool&lt;/P&gt;
&lt;P&gt;&lt;BR&gt;&amp;nbsp;&lt;/P&gt;&lt;B&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt"&gt;&lt;B style="mso-bidi-font-weight: normal"&gt;&lt;SPAN style="FONT-SIZE: 16pt"&gt;&lt;FONT face="Times New Roman"&gt;SEE ATTACHED MYXLVIEWER.ASPX PAGE!&lt;o:p&gt;&lt;/o:p&gt;&lt;/FONT&gt;&lt;/SPAN&gt;&lt;/B&gt;&lt;/P&gt;&lt;/B&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=843159" width="1" height="1"&gt;</description><enclosure url="http://blogs.msdn.com/luisbeonservices/attachment/843159.ashx" length="5674" type="application/xml" /><category domain="http://blogs.msdn.com/luisbeonservices/archive/tags/Excel+Services+Programmability/default.aspx">Excel Services Programmability</category></item><item><title>Consuming Sharepoint Lists in Excel Services</title><link>http://blogs.msdn.com/luisbeonservices/archive/2006/09/28/consuming-sharepoint-lists-in-excel-services.aspx</link><pubDate>Fri, 29 Sep 2006 09:42:00 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:776623</guid><dc:creator>LuisBE</dc:creator><slash:comments>32</slash:comments><comments>http://blogs.msdn.com/luisbeonservices/comments/776623.aspx</comments><wfw:commentRss>http://blogs.msdn.com/luisbeonservices/commentrss.aspx?PostID=776623</wfw:commentRss><description>&lt;P&gt;&lt;STRONG&gt;&amp;nbsp;&amp;lt;UPDATE: New CS file attached with a minor bug fix and some major code reduction since I&amp;nbsp;found the SharePoint format converter method :o) &amp;gt;&lt;/STRONG&gt;&lt;/P&gt;
&lt;P&gt;There are a few features that the v1 of Excel Services will not support out of the box.&amp;nbsp; One of these is grabbing data from Sharepoint Lists.&lt;/P&gt;
&lt;P&gt;Luckily enough the UDF framework allows us to write some pretty simple code that can grab the data from Sharepoint and return it to the Excel grid through an array formula.&lt;/P&gt;
&lt;P&gt;Since I ran into this limitation a few times and numerous people have been asking for this feature I decided to write a UDF that does just that.&lt;/P&gt;
&lt;P&gt;The goal here is to have an UDF that can be called as an array formula, whose function is to grab data from a Sharepoint and return it to the Excel grid.&lt;/P&gt;
&lt;P&gt;Here is the signature for the UDF I created:&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt; LINE-HEIGHT: normal; mso-layout-grid-align: none"&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: blue; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;public&lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt; &lt;SPAN style="COLOR: blue"&gt;object&lt;/SPAN&gt;[,] getSharepointView(&lt;SPAN style="COLOR: blue"&gt;string&lt;/SPAN&gt; serverName, &lt;SPAN style="COLOR: blue"&gt;string&lt;/SPAN&gt; siteName, &lt;SPAN style="COLOR: blue"&gt;string&lt;/SPAN&gt; listName, &lt;SPAN style="COLOR: blue"&gt;string&lt;/SPAN&gt; viewName, &lt;SPAN style="COLOR: blue"&gt;bool&lt;/SPAN&gt; getTitles)&lt;?xml:namespace prefix = o ns = "urn:schemas-microsoft-com:office:office" /&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt; LINE-HEIGHT: normal; mso-layout-grid-align: none"&gt;&lt;SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;&lt;o:p&gt;&amp;nbsp;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 10pt"&gt;&lt;B&gt;&lt;SPAN style="FONT-SIZE: 18pt; LINE-HEIGHT: 115%"&gt;&lt;FONT size=4&gt;Usage:&lt;o:p&gt;&lt;/o:p&gt;&lt;/FONT&gt;&lt;/SPAN&gt;&lt;/B&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 10pt"&gt;Basically you select the range in an Excel grid that you would like the List data returned to, type “=getSharepointView(“http://myserver.com”, “MySSPSite”, “MyList”, “MyView”, TRUE)” and CTRL+SHFT+ENTER.&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 10pt"&gt;That last parameter will return only the list data when it is FALSE, and will also return the list column titles when it is TRUE. &lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 10pt"&gt;Once you load the workbook to a server that has the UDF loaded (or on a client that has the COM add-in for this dll registered) you will get the data that user would see had he gone to the Sharepoint site himself.&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 10pt"&gt;At that point you can do with the data as you please… add some Conditional Formatting, use it as the source data for a Pivot, etc…&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 10pt"&gt;&lt;B&gt;&lt;SPAN style="FONT-SIZE: 18pt; LINE-HEIGHT: 115%"&gt;&lt;FONT size=4&gt;Code:&lt;o:p&gt;&lt;/o:p&gt;&lt;/FONT&gt;&lt;/SPAN&gt;&lt;/B&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 10pt"&gt;The code is a bit extensive to paste inline here, so I’m attaching the .cs file to this post.&lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp; &lt;/SPAN&gt;You will notice that I’m using the Microsoft.Sharepoint namespace which can be found in the Microsoft.Sharepoint.dll binary located in C:\Program Files\Common Files\Microsoft Shared\web server extensions\12\ISAPI on the Sharepoint server.&lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp; &lt;/SPAN&gt;I have also decorated my class so that you can register it as a COM add-in and use it in the Client as well as the Server.&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 10pt"&gt;&lt;B&gt;&lt;SPAN style="FONT-SIZE: 16pt; LINE-HEIGHT: 115%"&gt;&lt;FONT size=4&gt;SEE .CS FILE ATTACHED!&lt;/FONT&gt;&lt;/SPAN&gt;&lt;/B&gt;&lt;/P&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=776623" width="1" height="1"&gt;</description><enclosure url="http://blogs.msdn.com/luisbeonservices/attachment/776623.ashx" length="6127" type="application/octet-stream" /><category domain="http://blogs.msdn.com/luisbeonservices/archive/tags/Excel+Services+Programmability/default.aspx">Excel Services Programmability</category></item><item><title>Impersonating EWA users in your UDFs</title><link>http://blogs.msdn.com/luisbeonservices/archive/2006/09/28/impersonating-ewa-users-in-your-udfs.aspx</link><pubDate>Fri, 29 Sep 2006 09:18:00 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:776596</guid><dc:creator>LuisBE</dc:creator><slash:comments>1</slash:comments><comments>http://blogs.msdn.com/luisbeonservices/comments/776596.aspx</comments><wfw:commentRss>http://blogs.msdn.com/luisbeonservices/commentrss.aspx?PostID=776596</wfw:commentRss><description>&lt;P&gt;Excel Services UDFs are generally run under the credentials of the service account used by the Office Server installation.&amp;nbsp; This may not be exactly what you want if you would like your UDFs to return data that is specific to the user that opened the workbook.&amp;nbsp; This is also not what you would want if you want the UDF code to perform other functions (e.g. read/write to SQL, access system resources, etc...) under the credentials of the user that opened the workbook.&lt;/P&gt;
&lt;P&gt;In a more thorough example, you may want to have an UDF that will read certain information&amp;nbsp;from a SQL database.&amp;nbsp; It may be the case that depending on the user's credentials the information returned by SQL is different, and we want that reflected in our UDF so the data that is returned to Excel is correct.&lt;/P&gt;
&lt;P&gt;The function below will do everything you need.&amp;nbsp; All you have to do is call this function in your UDF (which needs to be decorated with the ReturnsPersonalInformation=true UdfMethod attribute)&amp;nbsp;before you do anything that needs that user's credentials:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;STRONG&gt;NOTE:&lt;/STRONG&gt; Shahar &lt;A class="" title="pointed out" href="http://blogs.msdn.com/cumgranosalis/archive/2006/11/09/impersonating-users-inside-udfs.aspx" mce_href="http://blogs.msdn.com/cumgranosalis/archive/2006/11/09/impersonating-users-inside-udfs.aspx"&gt;pointed out&lt;/A&gt; a bug that I left out here, once you are done doing what you'd like to do as the impersonated EWR user you will want to release the impersonation from the thread, so that it goes back to the default account, that way you don't have an Excel Server thread running with the user's credentials when it's not needed.&amp;nbsp;I have changed the code to fix this problem, here's the new code and how to use it.&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: green; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;// Causes the current UDF to impersonate the user that loaded it through EWR&lt;?xml:namespace prefix = o ns = "urn:schemas-microsoft-com:office:office" /&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: blue; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;private&lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt; &lt;SPAN style="COLOR: blue"&gt;&lt;SPAN style="COLOR: teal"&gt;WindowsImpersonationContext &lt;/SPAN&gt;&lt;/SPAN&gt;impersonateUser()&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"&gt;&lt;SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;{&lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;&lt;o:p&gt;&amp;nbsp;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"&gt;&lt;SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;&lt;o:p&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: teal; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; WindowsIdentity&lt;/SPAN&gt;&amp;nbsp;wi = &lt;FONT color=#0000ff&gt;null&lt;/FONT&gt;&lt;FONT color=#000000&gt;;&lt;/FONT&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"&gt;&lt;SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&amp;nbsp;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt; TEXT-INDENT: 0.5in; mso-layout-grid-align: none"&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: blue; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;try&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt; TEXT-INDENT: 0.5in; mso-layout-grid-align: none"&gt;&lt;SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;{&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt 0.5in; TEXT-INDENT: 0.5in; mso-layout-grid-align: none"&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: green; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;// Get the user that loaded Workbook &amp;amp; impersonate&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt 0.5in; TEXT-INDENT: 0.5in; mso-layout-grid-align: none"&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: green; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: green; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;// NOTE:&amp;nbsp;To re-use this for a Client UDF first&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt 0.5in; TEXT-INDENT: 0.5in; mso-layout-grid-align: none"&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: green; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: green; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: green; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;// check that your process name is w3wp since &lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt 0.5in; TEXT-INDENT: 0.5in; mso-layout-grid-align: none"&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: green; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: green; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: green; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: green; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;// impersonation is not needed&amp;nbsp;on the&amp;nbsp;Client.&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt 0.5in; TEXT-INDENT: 0.5in; mso-layout-grid-align: none"&gt;&lt;SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;wi = &lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;(&lt;SPAN style="COLOR: teal"&gt;WindowsIdentity&lt;/SPAN&gt;)&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt 0.5in; TEXT-INDENT: 0.5in; mso-layout-grid-align: none"&gt;&lt;SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;System.Threading.&lt;SPAN style="COLOR: teal"&gt;Thread&lt;/SPAN&gt;.CurrentPrincipal.Identity;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt 0.5in; mso-layout-grid-align: none"&gt;&lt;SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;}&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt; TEXT-INDENT: 0.5in; mso-layout-grid-align: none"&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: blue; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;catch&lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt; (System.&lt;SPAN style="COLOR: teal"&gt;Exception&lt;/SPAN&gt; ex)&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt; TEXT-INDENT: 0.5in; mso-layout-grid-align: none"&gt;&lt;SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;{&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt; TEXT-INDENT: 0.5in; mso-layout-grid-align: none"&gt;&lt;SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;FONT color=#0000ff&gt;throw new &lt;/FONT&gt;&lt;FONT color=#008080&gt;InvalidOperationException&lt;/FONT&gt;&lt;FONT color=#000000&gt;(&lt;/FONT&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt; TEXT-INDENT: 0.5in; mso-layout-grid-align: none"&gt;&lt;SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;&lt;FONT color=#000000&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;&lt;FONT color=#800000&gt;"Impersonation failed."&lt;/FONT&gt;)&lt;/FONT&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt; TEXT-INDENT: 0.5in; mso-layout-grid-align: none"&gt;&lt;SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;}&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"&gt;&lt;SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;&lt;o:p&gt;&amp;nbsp;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt; TEXT-INDENT: 0.5in; mso-layout-grid-align: none"&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: blue; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;&lt;SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: blue; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;return &lt;/SPAN&gt;&lt;FONT color=#000000&gt;wi.Impersonate();&lt;o:p&gt;&lt;/o:p&gt;&lt;/FONT&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 10pt"&gt;&lt;SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;}&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 10pt"&gt;&lt;SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;&lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;&lt;/SPAN&gt;&amp;nbsp;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 10pt"&gt;&lt;SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;&lt;STRONG&gt;USAGE:&lt;/STRONG&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 10pt"&gt;&lt;SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;To use this code such that you only impersonate the user during the needed block, here's what you do:&lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: green; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;// uses impersonation&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: green; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;&lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: blue; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;public&amp;nbsp;void&lt;SPAN style="FONT-SIZE: 10pt; COLOR: blue; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt; &lt;/SPAN&gt;&lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;useImpersonation()&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"&gt;&lt;SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;{&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"&gt;&lt;SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;SPAN style="COLOR: blue" minmax_bound="true"&gt;using&lt;/SPAN&gt; (&lt;SPAN style="COLOR: teal" minmax_bound="true"&gt;WindowsImpersonationContext&lt;/SPAN&gt; wiContext = impersonateUser())&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"&gt;&lt;SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; {&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"&gt;&lt;SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;SPAN style="FONT-SIZE: 10pt; COLOR: green; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;// Inside this block you are impersonating the user&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"&gt;&lt;SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;&lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; }&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"&gt;&lt;SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;SPAN style="FONT-SIZE: 10pt; COLOR: green; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;// No longer impersonating user&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"&gt;&lt;SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: green; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;}&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 10pt"&gt;&lt;SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;&lt;/SPAN&gt;&amp;nbsp;&lt;/P&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=776596" width="1" height="1"&gt;</description><category domain="http://blogs.msdn.com/luisbeonservices/archive/tags/Excel+Services+Programmability/default.aspx">Excel Services Programmability</category></item></channel></rss>