{"id":69,"date":"2023-10-15T13:09:06","date_gmt":"2023-10-15T11:09:06","guid":{"rendered":"https:\/\/www.broggi.dev\/blog\/?p=69"},"modified":"2023-10-20T12:34:14","modified_gmt":"2023-10-20T10:34:14","slug":"insert-images-in-a-powerpoint-template-with-broggisoft-officeexport","status":"publish","type":"post","link":"https:\/\/www.broggi.dev\/blog\/index.php\/2023\/10\/15\/insert-images-in-a-powerpoint-template-with-broggisoft-officeexport\/","title":{"rendered":"Insert images in a PowerPoint template with BroggiSoft.OfficeExport"},"content":{"rendered":"\n<p>Here is an example of using BroggiBoft.OfficeExport to insert an image into a PowerPoint template:<\/p>\n\n\n\n<p>First, you need to create a PowerPoint template containing a tag for the image that you want to insert. To do this, you must create a Rectangle shape of the desired size and put a <code>{{Img=YourNameValue}}<\/code> tag inside. For this in PowerPoint go to Insert &gt; Shapes &gt; Rectangle.<br>For this example the value of YourNameValue is logo.<\/p>\n\n\n\n<figure class=\"wp-block-image\"><a href=\"https:\/\/res.cloudinary.com\/practicaldev\/image\/fetch\/s--2XsonfoO--\/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800\/https:\/\/dev-to-uploads.s3.amazonaws.com\/uploads\/articles\/zks44rdljocm8ppp6yrh.png\"><img decoding=\"async\" src=\"https:\/\/res.cloudinary.com\/practicaldev\/image\/fetch\/s--2XsonfoO--\/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800\/https:\/\/dev-to-uploads.s3.amazonaws.com\/uploads\/articles\/zks44rdljocm8ppp6yrh.png\" alt=\"PowerPoint template with tags\"\/><\/a><\/figure>\n\n\n\n<p>Next you need to convert the image you want to insert to base64. You can use the Convert.ToBase64String class to convert the image to a base64 string.<\/p>\n\n\n\n<p>Create a dictionary that contains the image data with the key name that matches the tag in the template.<br><\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>var imageBase64 = Convert.ToBase64String(File.ReadAllBytes(\"logo.png\"));\nDictionary&lt;string, string&gt; data = new Dictionary&lt;string, string&gt;();\ndata.Add(\"logo\", imageBase64);\ndata.Add(\"title\", \"OfficeExport Example\");\n\n<\/code><\/pre>\n\n\n\n<p>Install the nuget package BroggiSoft.OfficeExport from: <a href=\"https:\/\/www.nuget.org\/packages\/BroggiSoft.OfficeExport\/\">https:\/\/www.nuget.org\/packages\/BroggiSoft.OfficeExport\/<\/a><\/p>\n\n\n\n<p>Finally, use the ExportFromDictionary method of the OfficeExport class to replace the tags in the template with the image data.<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>OfficeExport.ExportFromDictionary(\"template.docx\", \"output.docx\", data);\n<\/code><\/pre>\n\n\n\n<p>The output file &#8220;output.pptx&#8221; will now contain the image inserted into the Shape Rectangle named &#8220;logo&#8221; in the template, and the title will have been replaced by its corresponding value (here: OfficeExport Example).<\/p>\n\n\n\n<figure class=\"wp-block-image\"><a href=\"https:\/\/res.cloudinary.com\/practicaldev\/image\/fetch\/s--3LeATvVH--\/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800\/https:\/\/dev-to-uploads.s3.amazonaws.com\/uploads\/articles\/h8x5j0f8iz6zbi6tsqcg.png\"><img decoding=\"async\" src=\"https:\/\/res.cloudinary.com\/practicaldev\/image\/fetch\/s--3LeATvVH--\/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800\/https:\/\/dev-to-uploads.s3.amazonaws.com\/uploads\/articles\/h8x5j0f8iz6zbi6tsqcg.png\" alt=\"The powerpoint output after replacing the tags\"\/><\/a><\/figure>\n\n\n\n<p>It&#8217;s important to note that you can use the same steps to insert images into Word and Excel templates.<\/p>\n\n\n\n<p>You can find a test project on GitHub: <a href=\"https:\/\/github.com\/BroggiQ\/OfficeExportTest\">OfficeExportTest<\/a><\/p>\n\n\n\n<p><\/p>\n\n\n\n<p><\/p>\n\n\n\n<p><\/p>\n","protected":false},"excerpt":{"rendered":"<p>Here is an example of using BroggiBoft.OfficeExport to insert an image into a PowerPoint template: First, you need to create a PowerPoint template containing a tag for the image that you want to insert. To do this, you must create a Rectangle shape of the desired size and put a {{Img=YourNameValue}} tag inside. For this [&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":[11,12,14,13,15,16,9,8,10,17],"class_list":["post-69","post","type-post","status-publish","format-standard","hentry","category-officeexport","tag-base64","tag-broggisoft","tag-c-coding","tag-image-insertion","tag-nuget-package","tag-office-automation","tag-officeexport","tag-powerpoint","tag-template","tag-word-and-excel-templates"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v21.3 - https:\/\/yoast.com\/wordpress\/plugins\/seo\/ -->\r\n<title>Insert images in a PowerPoint template with BroggiSoft.OfficeExport - Quentin Broggi&#039;s blog about Angular &amp; .Net<\/title>\r\n<meta name=\"description\" content=\"Learn how to insert images into PowerPoint Templates using OfficeExport in .NET. Mail Merging into office document\" \/>\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\/10\/15\/insert-images-in-a-powerpoint-template-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=\"Insert images in a PowerPoint template with BroggiSoft.OfficeExport - Quentin Broggi&#039;s blog about Angular &amp; .Net\" \/>\r\n<meta property=\"og:description\" content=\"Learn how to insert images into PowerPoint Templates using OfficeExport in .NET. Mail Merging into office document\" \/>\r\n<meta property=\"og:url\" content=\"https:\/\/www.broggi.dev\/blog\/index.php\/2023\/10\/15\/insert-images-in-a-powerpoint-template-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-10-15T11:09:06+00:00\" \/>\r\n<meta property=\"article:modified_time\" content=\"2023-10-20T10:34:14+00:00\" \/>\r\n<meta property=\"og:image\" content=\"https:\/\/res.cloudinary.com\/practicaldev\/image\/fetch\/s--2XsonfoO--\/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800\/https:\/\/dev-to-uploads.s3.amazonaws.com\/uploads\/articles\/zks44rdljocm8ppp6yrh.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\/10\/15\/insert-images-in-a-powerpoint-template-with-broggisoft-officeexport\/#article\",\"isPartOf\":{\"@id\":\"https:\/\/www.broggi.dev\/blog\/index.php\/2023\/10\/15\/insert-images-in-a-powerpoint-template-with-broggisoft-officeexport\/\"},\"author\":{\"name\":\"Broggi Quentin\",\"@id\":\"https:\/\/www.broggi.dev\/blog\/#\/schema\/person\/720a0c86dcf121f7d788f878e2d6c4bb\"},\"headline\":\"Insert images in a PowerPoint template with BroggiSoft.OfficeExport\",\"datePublished\":\"2023-10-15T11:09:06+00:00\",\"dateModified\":\"2023-10-20T10:34:14+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\/\/www.broggi.dev\/blog\/index.php\/2023\/10\/15\/insert-images-in-a-powerpoint-template-with-broggisoft-officeexport\/\"},\"wordCount\":227,\"commentCount\":0,\"publisher\":{\"@id\":\"https:\/\/www.broggi.dev\/blog\/#\/schema\/person\/720a0c86dcf121f7d788f878e2d6c4bb\"},\"keywords\":[\"Base64\",\"BroggiSoft\",\"C# Coding\",\"Image Insertion\",\"NuGet Package\",\"Office Automation\",\"OfficeExport\",\"PowerPoint\",\"Template\",\"Word and Excel Templates.\"],\"articleSection\":[\"OfficeExport\"],\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"CommentAction\",\"name\":\"Comment\",\"target\":[\"https:\/\/www.broggi.dev\/blog\/index.php\/2023\/10\/15\/insert-images-in-a-powerpoint-template-with-broggisoft-officeexport\/#respond\"]}]},{\"@type\":\"WebPage\",\"@id\":\"https:\/\/www.broggi.dev\/blog\/index.php\/2023\/10\/15\/insert-images-in-a-powerpoint-template-with-broggisoft-officeexport\/\",\"url\":\"https:\/\/www.broggi.dev\/blog\/index.php\/2023\/10\/15\/insert-images-in-a-powerpoint-template-with-broggisoft-officeexport\/\",\"name\":\"Insert images in a PowerPoint template with BroggiSoft.OfficeExport - Quentin Broggi&#039;s blog about Angular &amp; .Net\",\"isPartOf\":{\"@id\":\"https:\/\/www.broggi.dev\/blog\/#website\"},\"datePublished\":\"2023-10-15T11:09:06+00:00\",\"dateModified\":\"2023-10-20T10:34:14+00:00\",\"description\":\"Learn how to insert images into PowerPoint Templates using OfficeExport in .NET. Mail Merging into office document\",\"breadcrumb\":{\"@id\":\"https:\/\/www.broggi.dev\/blog\/index.php\/2023\/10\/15\/insert-images-in-a-powerpoint-template-with-broggisoft-officeexport\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/www.broggi.dev\/blog\/index.php\/2023\/10\/15\/insert-images-in-a-powerpoint-template-with-broggisoft-officeexport\/\"]}]},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/www.broggi.dev\/blog\/index.php\/2023\/10\/15\/insert-images-in-a-powerpoint-template-with-broggisoft-officeexport\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\/\/www.broggi.dev\/blog\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Insert images in a PowerPoint template 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":"Insert images in a PowerPoint template with BroggiSoft.OfficeExport - Quentin Broggi&#039;s blog about Angular &amp; .Net","description":"Learn how to insert images into PowerPoint Templates using OfficeExport in .NET. Mail Merging into office document","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\/10\/15\/insert-images-in-a-powerpoint-template-with-broggisoft-officeexport\/","og_locale":"en_US","og_type":"article","og_title":"Insert images in a PowerPoint template with BroggiSoft.OfficeExport - Quentin Broggi&#039;s blog about Angular &amp; .Net","og_description":"Learn how to insert images into PowerPoint Templates using OfficeExport in .NET. Mail Merging into office document","og_url":"https:\/\/www.broggi.dev\/blog\/index.php\/2023\/10\/15\/insert-images-in-a-powerpoint-template-with-broggisoft-officeexport\/","og_site_name":"Quentin Broggi&#039;s blog about Angular &amp; .Net","article_published_time":"2023-10-15T11:09:06+00:00","article_modified_time":"2023-10-20T10:34:14+00:00","og_image":[{"url":"https:\/\/res.cloudinary.com\/practicaldev\/image\/fetch\/s--2XsonfoO--\/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800\/https:\/\/dev-to-uploads.s3.amazonaws.com\/uploads\/articles\/zks44rdljocm8ppp6yrh.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\/10\/15\/insert-images-in-a-powerpoint-template-with-broggisoft-officeexport\/#article","isPartOf":{"@id":"https:\/\/www.broggi.dev\/blog\/index.php\/2023\/10\/15\/insert-images-in-a-powerpoint-template-with-broggisoft-officeexport\/"},"author":{"name":"Broggi Quentin","@id":"https:\/\/www.broggi.dev\/blog\/#\/schema\/person\/720a0c86dcf121f7d788f878e2d6c4bb"},"headline":"Insert images in a PowerPoint template with BroggiSoft.OfficeExport","datePublished":"2023-10-15T11:09:06+00:00","dateModified":"2023-10-20T10:34:14+00:00","mainEntityOfPage":{"@id":"https:\/\/www.broggi.dev\/blog\/index.php\/2023\/10\/15\/insert-images-in-a-powerpoint-template-with-broggisoft-officeexport\/"},"wordCount":227,"commentCount":0,"publisher":{"@id":"https:\/\/www.broggi.dev\/blog\/#\/schema\/person\/720a0c86dcf121f7d788f878e2d6c4bb"},"keywords":["Base64","BroggiSoft","C# Coding","Image Insertion","NuGet Package","Office Automation","OfficeExport","PowerPoint","Template","Word and Excel Templates."],"articleSection":["OfficeExport"],"inLanguage":"en-US","potentialAction":[{"@type":"CommentAction","name":"Comment","target":["https:\/\/www.broggi.dev\/blog\/index.php\/2023\/10\/15\/insert-images-in-a-powerpoint-template-with-broggisoft-officeexport\/#respond"]}]},{"@type":"WebPage","@id":"https:\/\/www.broggi.dev\/blog\/index.php\/2023\/10\/15\/insert-images-in-a-powerpoint-template-with-broggisoft-officeexport\/","url":"https:\/\/www.broggi.dev\/blog\/index.php\/2023\/10\/15\/insert-images-in-a-powerpoint-template-with-broggisoft-officeexport\/","name":"Insert images in a PowerPoint template with BroggiSoft.OfficeExport - Quentin Broggi&#039;s blog about Angular &amp; .Net","isPartOf":{"@id":"https:\/\/www.broggi.dev\/blog\/#website"},"datePublished":"2023-10-15T11:09:06+00:00","dateModified":"2023-10-20T10:34:14+00:00","description":"Learn how to insert images into PowerPoint Templates using OfficeExport in .NET. Mail Merging into office document","breadcrumb":{"@id":"https:\/\/www.broggi.dev\/blog\/index.php\/2023\/10\/15\/insert-images-in-a-powerpoint-template-with-broggisoft-officeexport\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/www.broggi.dev\/blog\/index.php\/2023\/10\/15\/insert-images-in-a-powerpoint-template-with-broggisoft-officeexport\/"]}]},{"@type":"BreadcrumbList","@id":"https:\/\/www.broggi.dev\/blog\/index.php\/2023\/10\/15\/insert-images-in-a-powerpoint-template-with-broggisoft-officeexport\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/www.broggi.dev\/blog\/"},{"@type":"ListItem","position":2,"name":"Insert images in a PowerPoint template 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\/69","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=69"}],"version-history":[{"count":1,"href":"https:\/\/www.broggi.dev\/blog\/index.php\/wp-json\/wp\/v2\/posts\/69\/revisions"}],"predecessor-version":[{"id":70,"href":"https:\/\/www.broggi.dev\/blog\/index.php\/wp-json\/wp\/v2\/posts\/69\/revisions\/70"}],"wp:attachment":[{"href":"https:\/\/www.broggi.dev\/blog\/index.php\/wp-json\/wp\/v2\/media?parent=69"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.broggi.dev\/blog\/index.php\/wp-json\/wp\/v2\/categories?post=69"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.broggi.dev\/blog\/index.php\/wp-json\/wp\/v2\/tags?post=69"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}