{"id":64,"date":"2012-04-17T12:37:13","date_gmt":"2012-04-17T04:37:13","guid":{"rendered":"http:\/\/fishinbox.tk\/?p=64"},"modified":"2012-04-17T12:37:13","modified_gmt":"2012-04-17T04:37:13","slug":"excel-selected-range-vsto","status":"publish","type":"post","link":"https:\/\/zhuangzr.me\/wordpress\/2012\/04\/excel-selected-range-vsto\/","title":{"rendered":"Get Excel Selected Range via VSTO with C#"},"content":{"rendered":"<p>These days I have been working on the development of an Excel Add-in and learnt a way to get the currently selected range in Excel.<br \/>\nTake it for example that your Project namespace is ExcelAddIn. Firstly, you should refer the interop by following code:<\/p>\n<pre class=\"brush: csharp; title: ; notranslate\" title=\"\">\nusing Microsoft.Office.Interop.Excel;\n<\/pre>\n<p>and you can get a string consistent with the Range you selected by following code:<\/p>\n<pre class=\"brush: csharp; title: ; notranslate\" title=\"\">\nExcelAddIn.Globals.ThisAddIn.Application.Selection.Address;\n<\/pre>\n<p>which would return a string in format like &#8220;$A$1:$B$2&#8243; for rectangles,&#8221;$1:$2&#8221; for rows and &#8220;$A:$B&#8221; for columns.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>These days I have been working on the development of an Excel Add-in and learnt a way to get the currently selected range in Excel. Take it for example that your Project namespace is ExcelAddIn. Firstly, you should refer the interop by following code: using Microsoft.Office.Interop.Excel; and you can get a string consistent with the &hellip; <\/p>\n<p class=\"link-more\"><a href=\"https:\/\/zhuangzr.me\/wordpress\/2012\/04\/excel-selected-range-vsto\/\" class=\"more-link\">Continue reading<span class=\"screen-reader-text\"> &#8220;Get Excel Selected Range via VSTO with C#&#8221;<\/span><\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[16],"tags":[25,29,31,42,50],"class_list":["post-64","post","type-post","status-publish","format-standard","hentry","category-csharp-programming","tag-c","tag-csharp","tag-excel","tag-office","tag-vsto"],"aioseo_notices":[],"_links":{"self":[{"href":"https:\/\/zhuangzr.me\/wordpress\/wp-json\/wp\/v2\/posts\/64","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/zhuangzr.me\/wordpress\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/zhuangzr.me\/wordpress\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/zhuangzr.me\/wordpress\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/zhuangzr.me\/wordpress\/wp-json\/wp\/v2\/comments?post=64"}],"version-history":[{"count":0,"href":"https:\/\/zhuangzr.me\/wordpress\/wp-json\/wp\/v2\/posts\/64\/revisions"}],"wp:attachment":[{"href":"https:\/\/zhuangzr.me\/wordpress\/wp-json\/wp\/v2\/media?parent=64"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/zhuangzr.me\/wordpress\/wp-json\/wp\/v2\/categories?post=64"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/zhuangzr.me\/wordpress\/wp-json\/wp\/v2\/tags?post=64"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}