{"id":28,"date":"2023-09-30T15:25:15","date_gmt":"2023-09-30T13:25:15","guid":{"rendered":"https:\/\/www.broggisoft.com\/blog\/?p=28"},"modified":"2023-10-20T12:36:26","modified_gmt":"2023-10-20T10:36:26","slug":"how-to-mail-merge-in-net-word-excel-powerpoint-with-broggisoft-officeexport","status":"publish","type":"post","link":"https:\/\/www.broggi.dev\/blog\/index.php\/2023\/09\/30\/how-to-mail-merge-in-net-word-excel-powerpoint-with-broggisoft-officeexport\/","title":{"rendered":"How to mail merge in .Net (Word, Excel, PowerPoint) with BroggiSoft.OfficeExport"},"content":{"rendered":"\n<p>I created a Nuget package, <a href=\"https:\/\/www.nuget.org\/packages\/BroggiSoft.OfficeExport\">BroggiSoft.OfficeExport<\/a>, to easily export data to an office document (Word, Excel and PowerPoint).<\/p>\n\n\n\n<p>First you create a template with tags like in Angular, for example you can set a tag <code>{{City}}<\/code> in your document. In your .Net application, you create for example a Dictionary with City as key and Paris as value and it will be replaced by the corresponding value. This style will be preserved, if you set a tag in italics the new value will also be in italics.<\/p>\n\n\n\n<p>You can also send your data as a json or as an object.<\/p>\n\n\n\n<p>Then you call the OfficeExport\u2019s functions.<\/p>\n\n\n\n<p>For information tags that do not have corresponding values will be removed.<\/p>\n\n\n\n<p>The package also allows you to handle arrays. To do this, create a basic table in Word or PowerPoint and you add a tag like this <code>{{Lines[i].NetIncome}}<\/code> on a line, this has for effect to replace this line by the first value of your array and add a line for the other rows of your array.<\/p>\n\n\n\n<p>In this example OfficeExport will create a new document OutPut.docx, but you can get the result as a blob.<\/p>\n\n\n\n<figure class=\"wp-block-image size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"800\" height=\"381\" src=\"https:\/\/www.broggisoft.com\/blog\/wp-content\/uploads\/2023\/09\/ewidkb3smjjd1l61hxzn-2.png\" alt=\"A Word Template\" class=\"wp-image-36\" srcset=\"https:\/\/www.broggi.dev\/blog\/wp-content\/uploads\/2023\/09\/ewidkb3smjjd1l61hxzn-2.png 800w, https:\/\/www.broggi.dev\/blog\/wp-content\/uploads\/2023\/09\/ewidkb3smjjd1l61hxzn-2-300x143.png 300w, https:\/\/www.broggi.dev\/blog\/wp-content\/uploads\/2023\/09\/ewidkb3smjjd1l61hxzn-2-768x366.png 768w\" sizes=\"auto, (max-width: 800px) 100vw, 800px\" \/><\/figure>\n\n\n\n<p>Become<\/p>\n\n\n\n<figure class=\"wp-block-image size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"800\" height=\"386\" src=\"https:\/\/www.broggisoft.com\/blog\/wp-content\/uploads\/2023\/09\/343vt0h1mqu5yw9z0pob.png\" alt=\"The output Word Document\" class=\"wp-image-34\" srcset=\"https:\/\/www.broggi.dev\/blog\/wp-content\/uploads\/2023\/09\/343vt0h1mqu5yw9z0pob.png 800w, https:\/\/www.broggi.dev\/blog\/wp-content\/uploads\/2023\/09\/343vt0h1mqu5yw9z0pob-300x145.png 300w, https:\/\/www.broggi.dev\/blog\/wp-content\/uploads\/2023\/09\/343vt0h1mqu5yw9z0pob-768x371.png 768w\" sizes=\"auto, (max-width: 800px) 100vw, 800px\" \/><\/figure>\n\n\n\n<p id=\"e918\">Please feel free to provide feedback to me at contact@broggisoft.com.<\/p>\n\n\n\n<p id=\"6daf\">You will find all the documentation on <a href=\"https:\/\/www.broggisoft.com\/\" rel=\"noreferrer noopener\" target=\"_blank\">broggisoft.com<\/a>.<\/p>\n\n\n\n<p id=\"5b0b\">You can find a test project on GitHub: <a href=\"https:\/\/github.com\/BroggiQ\/OfficeExportTest\" rel=\"noreferrer noopener\" target=\"_blank\">OfficeExportTest<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<p>I created a Nuget package, BroggiSoft.OfficeExport, to easily export data to an office document (Word, Excel and PowerPoint). First you create a template with tags like in Angular, for example you can set a tag {{City}} in your document. In your .Net application, you create for example a Dictionary with City as key and Paris [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[6],"tags":[19,22,23,24,20,21,9,8,18],"class_list":["post-28","post","type-post","status-publish","format-standard","hentry","category-officeexport","tag-net","tag-angular-tags","tag-arrays","tag-document-generation","tag-excel","tag-json-data","tag-officeexport","tag-powerpoint","tag-word"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v21.3 - https:\/\/yoast.com\/wordpress\/plugins\/seo\/ -->\r\n<title>How to mail merge in .Net (Word, Excel, PowerPoint) with BroggiSoft.OfficeExport - Quentin Broggi&#039;s blog about Angular &amp; .Net<\/title>\r\n<meta name=\"description\" content=\"Explore how to effectively use tags with OfficeExport in .Net applications to manipulate and generate Word, Excel, and PowerPoint documents, while preserving styling and handling arrays.\" \/>\r\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\r\n<link rel=\"canonical\" href=\"https:\/\/www.broggi.dev\/blog\/index.php\/2023\/09\/30\/how-to-mail-merge-in-net-word-excel-powerpoint-with-broggisoft-officeexport\/\" \/>\r\n<meta property=\"og:locale\" content=\"en_US\" \/>\r\n<meta property=\"og:type\" content=\"article\" \/>\r\n<meta property=\"og:title\" content=\"How to mail merge in .Net (Word, Excel, PowerPoint) with BroggiSoft.OfficeExport - Quentin Broggi&#039;s blog about Angular &amp; .Net\" \/>\r\n<meta property=\"og:description\" content=\"Explore how to effectively use tags with OfficeExport in .Net applications to manipulate and generate Word, Excel, and PowerPoint documents, while preserving styling and handling arrays.\" \/>\r\n<meta property=\"og:url\" content=\"https:\/\/www.broggi.dev\/blog\/index.php\/2023\/09\/30\/how-to-mail-merge-in-net-word-excel-powerpoint-with-broggisoft-officeexport\/\" \/>\r\n<meta property=\"og:site_name\" content=\"Quentin Broggi&#039;s blog about Angular &amp; .Net\" \/>\r\n<meta property=\"article:published_time\" content=\"2023-09-30T13:25:15+00:00\" \/>\r\n<meta property=\"article:modified_time\" content=\"2023-10-20T10:36:26+00:00\" \/>\r\n<meta property=\"og:image\" content=\"https:\/\/www.broggisoft.com\/blog\/wp-content\/uploads\/2023\/09\/ewidkb3smjjd1l61hxzn-2.png\" \/>\r\n<meta name=\"author\" content=\"Broggi Quentin\" \/>\r\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\r\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"Broggi Quentin\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"2 minutes\" \/>\r\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\/\/www.broggi.dev\/blog\/index.php\/2023\/09\/30\/how-to-mail-merge-in-net-word-excel-powerpoint-with-broggisoft-officeexport\/#article\",\"isPartOf\":{\"@id\":\"https:\/\/www.broggi.dev\/blog\/index.php\/2023\/09\/30\/how-to-mail-merge-in-net-word-excel-powerpoint-with-broggisoft-officeexport\/\"},\"author\":{\"name\":\"Broggi Quentin\",\"@id\":\"https:\/\/www.broggi.dev\/blog\/#\/schema\/person\/720a0c86dcf121f7d788f878e2d6c4bb\"},\"headline\":\"How to mail merge in .Net (Word, Excel, PowerPoint) with BroggiSoft.OfficeExport\",\"datePublished\":\"2023-09-30T13:25:15+00:00\",\"dateModified\":\"2023-10-20T10:36:26+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\/\/www.broggi.dev\/blog\/index.php\/2023\/09\/30\/how-to-mail-merge-in-net-word-excel-powerpoint-with-broggisoft-officeexport\/\"},\"wordCount\":236,\"commentCount\":0,\"publisher\":{\"@id\":\"https:\/\/www.broggi.dev\/blog\/#\/schema\/person\/720a0c86dcf121f7d788f878e2d6c4bb\"},\"keywords\":[\".Net\",\"Angular Tags\",\"Arrays\",\"Document Generation\",\"Excel\",\"JSON Data\",\"OfficeExport\",\"PowerPoint\",\"Word\"],\"articleSection\":[\"OfficeExport\"],\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"CommentAction\",\"name\":\"Comment\",\"target\":[\"https:\/\/www.broggi.dev\/blog\/index.php\/2023\/09\/30\/how-to-mail-merge-in-net-word-excel-powerpoint-with-broggisoft-officeexport\/#respond\"]}]},{\"@type\":\"WebPage\",\"@id\":\"https:\/\/www.broggi.dev\/blog\/index.php\/2023\/09\/30\/how-to-mail-merge-in-net-word-excel-powerpoint-with-broggisoft-officeexport\/\",\"url\":\"https:\/\/www.broggi.dev\/blog\/index.php\/2023\/09\/30\/how-to-mail-merge-in-net-word-excel-powerpoint-with-broggisoft-officeexport\/\",\"name\":\"How to mail merge in .Net (Word, Excel, PowerPoint) with BroggiSoft.OfficeExport - Quentin Broggi&#039;s blog about Angular &amp; .Net\",\"isPartOf\":{\"@id\":\"https:\/\/www.broggi.dev\/blog\/#website\"},\"datePublished\":\"2023-09-30T13:25:15+00:00\",\"dateModified\":\"2023-10-20T10:36:26+00:00\",\"description\":\"Explore how to effectively use tags with OfficeExport in .Net applications to manipulate and generate Word, Excel, and PowerPoint documents, while preserving styling and handling arrays.\",\"breadcrumb\":{\"@id\":\"https:\/\/www.broggi.dev\/blog\/index.php\/2023\/09\/30\/how-to-mail-merge-in-net-word-excel-powerpoint-with-broggisoft-officeexport\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/www.broggi.dev\/blog\/index.php\/2023\/09\/30\/how-to-mail-merge-in-net-word-excel-powerpoint-with-broggisoft-officeexport\/\"]}]},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/www.broggi.dev\/blog\/index.php\/2023\/09\/30\/how-to-mail-merge-in-net-word-excel-powerpoint-with-broggisoft-officeexport\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\/\/www.broggi.dev\/blog\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"How to mail merge in .Net (Word, Excel, PowerPoint) with BroggiSoft.OfficeExport\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\/\/www.broggi.dev\/blog\/#website\",\"url\":\"https:\/\/www.broggi.dev\/blog\/\",\"name\":\"Broggi Quentin blog about Angular & .Net\",\"description\":\"Exploring Angular &amp; .NET Development\",\"publisher\":{\"@id\":\"https:\/\/www.broggi.dev\/blog\/#\/schema\/person\/720a0c86dcf121f7d788f878e2d6c4bb\"},\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\/\/www.broggi.dev\/blog\/?s={search_term_string}\"},\"query-input\":\"required name=search_term_string\"}],\"inLanguage\":\"en-US\"},{\"@type\":[\"Person\",\"Organization\"],\"@id\":\"https:\/\/www.broggi.dev\/blog\/#\/schema\/person\/720a0c86dcf121f7d788f878e2d6c4bb\",\"name\":\"Broggi Quentin\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/www.broggi.dev\/blog\/#\/schema\/person\/image\/\",\"url\":\"https:\/\/www.broggi.dev\/blog\/wp-content\/uploads\/2023\/09\/ultralight_photo2-1-scaled.jpg\",\"contentUrl\":\"https:\/\/www.broggi.dev\/blog\/wp-content\/uploads\/2023\/09\/ultralight_photo2-1-scaled.jpg\",\"width\":2560,\"height\":1828,\"caption\":\"Broggi Quentin\"},\"logo\":{\"@id\":\"https:\/\/www.broggi.dev\/blog\/#\/schema\/person\/image\/\"},\"description\":\"I'm an independent .NET \/ Angular developer with a passion for creating dynamic and efficient solutions. With years of experience under my belt, I've had the opportunity to work on diverse projects, always aiming to bridge the gap between technology and user needs. If you're interested in collaborating or just want to connect, feel free to reach out to me on LinkedIn: https:\/\/www.linkedin.com\/in\/quentin-broggi\/. I'm always open to new opportunities and discussions!\",\"sameAs\":[\"https:\/\/www.broggisoft.com\/blog\",\"https:\/\/www.linkedin.com\/in\/quentin-broggi\/\"],\"url\":\"https:\/\/www.broggi.dev\/blog\/index.php\/author\/adminblog\/\"}]}<\/script>\r\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"How to mail merge in .Net (Word, Excel, PowerPoint) with BroggiSoft.OfficeExport - Quentin Broggi&#039;s blog about Angular &amp; .Net","description":"Explore how to effectively use tags with OfficeExport in .Net applications to manipulate and generate Word, Excel, and PowerPoint documents, while preserving styling and handling arrays.","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/www.broggi.dev\/blog\/index.php\/2023\/09\/30\/how-to-mail-merge-in-net-word-excel-powerpoint-with-broggisoft-officeexport\/","og_locale":"en_US","og_type":"article","og_title":"How to mail merge in .Net (Word, Excel, PowerPoint) with BroggiSoft.OfficeExport - Quentin Broggi&#039;s blog about Angular &amp; .Net","og_description":"Explore how to effectively use tags with OfficeExport in .Net applications to manipulate and generate Word, Excel, and PowerPoint documents, while preserving styling and handling arrays.","og_url":"https:\/\/www.broggi.dev\/blog\/index.php\/2023\/09\/30\/how-to-mail-merge-in-net-word-excel-powerpoint-with-broggisoft-officeexport\/","og_site_name":"Quentin Broggi&#039;s blog about Angular &amp; .Net","article_published_time":"2023-09-30T13:25:15+00:00","article_modified_time":"2023-10-20T10:36:26+00:00","og_image":[{"url":"https:\/\/www.broggisoft.com\/blog\/wp-content\/uploads\/2023\/09\/ewidkb3smjjd1l61hxzn-2.png"}],"author":"Broggi Quentin","twitter_card":"summary_large_image","twitter_misc":{"Written by":"Broggi Quentin","Est. reading time":"2 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/www.broggi.dev\/blog\/index.php\/2023\/09\/30\/how-to-mail-merge-in-net-word-excel-powerpoint-with-broggisoft-officeexport\/#article","isPartOf":{"@id":"https:\/\/www.broggi.dev\/blog\/index.php\/2023\/09\/30\/how-to-mail-merge-in-net-word-excel-powerpoint-with-broggisoft-officeexport\/"},"author":{"name":"Broggi Quentin","@id":"https:\/\/www.broggi.dev\/blog\/#\/schema\/person\/720a0c86dcf121f7d788f878e2d6c4bb"},"headline":"How to mail merge in .Net (Word, Excel, PowerPoint) with BroggiSoft.OfficeExport","datePublished":"2023-09-30T13:25:15+00:00","dateModified":"2023-10-20T10:36:26+00:00","mainEntityOfPage":{"@id":"https:\/\/www.broggi.dev\/blog\/index.php\/2023\/09\/30\/how-to-mail-merge-in-net-word-excel-powerpoint-with-broggisoft-officeexport\/"},"wordCount":236,"commentCount":0,"publisher":{"@id":"https:\/\/www.broggi.dev\/blog\/#\/schema\/person\/720a0c86dcf121f7d788f878e2d6c4bb"},"keywords":[".Net","Angular Tags","Arrays","Document Generation","Excel","JSON Data","OfficeExport","PowerPoint","Word"],"articleSection":["OfficeExport"],"inLanguage":"en-US","potentialAction":[{"@type":"CommentAction","name":"Comment","target":["https:\/\/www.broggi.dev\/blog\/index.php\/2023\/09\/30\/how-to-mail-merge-in-net-word-excel-powerpoint-with-broggisoft-officeexport\/#respond"]}]},{"@type":"WebPage","@id":"https:\/\/www.broggi.dev\/blog\/index.php\/2023\/09\/30\/how-to-mail-merge-in-net-word-excel-powerpoint-with-broggisoft-officeexport\/","url":"https:\/\/www.broggi.dev\/blog\/index.php\/2023\/09\/30\/how-to-mail-merge-in-net-word-excel-powerpoint-with-broggisoft-officeexport\/","name":"How to mail merge in .Net (Word, Excel, PowerPoint) with BroggiSoft.OfficeExport - Quentin Broggi&#039;s blog about Angular &amp; .Net","isPartOf":{"@id":"https:\/\/www.broggi.dev\/blog\/#website"},"datePublished":"2023-09-30T13:25:15+00:00","dateModified":"2023-10-20T10:36:26+00:00","description":"Explore how to effectively use tags with OfficeExport in .Net applications to manipulate and generate Word, Excel, and PowerPoint documents, while preserving styling and handling arrays.","breadcrumb":{"@id":"https:\/\/www.broggi.dev\/blog\/index.php\/2023\/09\/30\/how-to-mail-merge-in-net-word-excel-powerpoint-with-broggisoft-officeexport\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/www.broggi.dev\/blog\/index.php\/2023\/09\/30\/how-to-mail-merge-in-net-word-excel-powerpoint-with-broggisoft-officeexport\/"]}]},{"@type":"BreadcrumbList","@id":"https:\/\/www.broggi.dev\/blog\/index.php\/2023\/09\/30\/how-to-mail-merge-in-net-word-excel-powerpoint-with-broggisoft-officeexport\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/www.broggi.dev\/blog\/"},{"@type":"ListItem","position":2,"name":"How to mail merge in .Net (Word, Excel, PowerPoint) with BroggiSoft.OfficeExport"}]},{"@type":"WebSite","@id":"https:\/\/www.broggi.dev\/blog\/#website","url":"https:\/\/www.broggi.dev\/blog\/","name":"Broggi Quentin blog about Angular & .Net","description":"Exploring Angular &amp; .NET Development","publisher":{"@id":"https:\/\/www.broggi.dev\/blog\/#\/schema\/person\/720a0c86dcf121f7d788f878e2d6c4bb"},"potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/www.broggi.dev\/blog\/?s={search_term_string}"},"query-input":"required name=search_term_string"}],"inLanguage":"en-US"},{"@type":["Person","Organization"],"@id":"https:\/\/www.broggi.dev\/blog\/#\/schema\/person\/720a0c86dcf121f7d788f878e2d6c4bb","name":"Broggi Quentin","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/www.broggi.dev\/blog\/#\/schema\/person\/image\/","url":"https:\/\/www.broggi.dev\/blog\/wp-content\/uploads\/2023\/09\/ultralight_photo2-1-scaled.jpg","contentUrl":"https:\/\/www.broggi.dev\/blog\/wp-content\/uploads\/2023\/09\/ultralight_photo2-1-scaled.jpg","width":2560,"height":1828,"caption":"Broggi Quentin"},"logo":{"@id":"https:\/\/www.broggi.dev\/blog\/#\/schema\/person\/image\/"},"description":"I'm an independent .NET \/ Angular developer with a passion for creating dynamic and efficient solutions. With years of experience under my belt, I've had the opportunity to work on diverse projects, always aiming to bridge the gap between technology and user needs. If you're interested in collaborating or just want to connect, feel free to reach out to me on LinkedIn: https:\/\/www.linkedin.com\/in\/quentin-broggi\/. I'm always open to new opportunities and discussions!","sameAs":["https:\/\/www.broggisoft.com\/blog","https:\/\/www.linkedin.com\/in\/quentin-broggi\/"],"url":"https:\/\/www.broggi.dev\/blog\/index.php\/author\/adminblog\/"}]}},"_links":{"self":[{"href":"https:\/\/www.broggi.dev\/blog\/index.php\/wp-json\/wp\/v2\/posts\/28","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.broggi.dev\/blog\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.broggi.dev\/blog\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.broggi.dev\/blog\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.broggi.dev\/blog\/index.php\/wp-json\/wp\/v2\/comments?post=28"}],"version-history":[{"count":4,"href":"https:\/\/www.broggi.dev\/blog\/index.php\/wp-json\/wp\/v2\/posts\/28\/revisions"}],"predecessor-version":[{"id":38,"href":"https:\/\/www.broggi.dev\/blog\/index.php\/wp-json\/wp\/v2\/posts\/28\/revisions\/38"}],"wp:attachment":[{"href":"https:\/\/www.broggi.dev\/blog\/index.php\/wp-json\/wp\/v2\/media?parent=28"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.broggi.dev\/blog\/index.php\/wp-json\/wp\/v2\/categories?post=28"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.broggi.dev\/blog\/index.php\/wp-json\/wp\/v2\/tags?post=28"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}