{"id":241,"date":"2022-01-26T08:46:20","date_gmt":"2022-01-26T08:46:20","guid":{"rendered":"https:\/\/www.trichview.com\/wp\/?p=241"},"modified":"2022-01-26T08:46:21","modified_gmt":"2022-01-26T08:46:21","slug":"demo-page-background-and-border-in-rtf-and-docx","status":"publish","type":"post","link":"https:\/\/www.trichview.com\/wp\/2022\/01\/26\/demo-page-background-and-border-in-rtf-and-docx\/","title":{"rendered":"Demo: Page background and border in RTF and DocX"},"content":{"rendered":"\n<p>Microsoft Word Documents (DocX and RTF) do not support page background directly.<br>However, there is a workaround: you can insert a text box in a header or a footer, and add an image to this textbox. Additionally, this textbox can have a border.<br>Actually, Microsoft Word itself uses this technique when adding a page watermark.<\/p>\n\n\n\n<p>The demo shows how to generate a document having a page border and a page background image, and how to same it to DocX and RTF files. The demo can be found in the support forum: <a href=\"https:\/\/www.trichview.com\/forums\/viewtopic.php?t=10793\" target=\"_blank\" rel=\"noreferrer noopener\">https:\/\/www.trichview.com\/forums\/viewtopic.php?t=10793<\/a><\/p>\n\n\n\n<p>There are 4 versions of the demo: (for TRichView and for ScaleRichView) x (for Delphi and for C++Builder 11)<br>The demos for C++Builder 11 can be used in older versions of C++Builder, you just need to change references to packages in the CBProj file.<\/p>\n\n\n\n<p><strong>Note 1: <\/strong>A text box is positioned relative to the whole page, its size and position is calculated in absolute values (depending on the page size and margins).<br>Why don&#8217;t we used sizing and positioning relative to the main text area? It was done for compatibility with Libre Office. Unfortunately, its current version has problems with advanced options for textbox positioning.<\/p>\n\n\n\n<p><strong>Note 2:<\/strong> This demo shows the simplest case: the same background image for all pages. TRichView and ScaleRichView support special headers for the first page and odd\/even pages, so they can have different background images and borders.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Microsoft Word Documents (DocX and RTF) do not support page background directly.However, there is a workaround: you can insert a text box in a header or a footer, and add an image to this textbox. Additionally, this textbox can have a border.Actually, Microsoft Word itself uses this technique when adding a page watermark. The demo [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":242,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_uag_custom_page_level_css":"","site-sidebar-layout":"default","site-content-layout":"","ast-site-content-layout":"default","site-content-style":"default","site-sidebar-style":"default","ast-global-header-display":"","ast-banner-title-visibility":"","ast-main-header-display":"","ast-hfb-above-header-display":"","ast-hfb-below-header-display":"","ast-hfb-mobile-header-display":"","site-post-title":"","ast-breadcrumbs-content":"","ast-featured-img":"","footer-sml-layout":"","ast-disable-related-posts":"","theme-transparent-header-meta":"","adv-header-id-meta":"","stick-header-meta":"","header-above-stick-meta":"","header-main-stick-meta":"","header-below-stick-meta":"","astra-migrate-meta-layouts":"default","ast-page-background-enabled":"default","ast-page-background-meta":{"desktop":{"background-color":"","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""},"tablet":{"background-color":"","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""},"mobile":{"background-color":"","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""}},"ast-content-background-meta":{"desktop":{"background-color":"var(--ast-global-color-5)","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""},"tablet":{"background-color":"var(--ast-global-color-5)","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""},"mobile":{"background-color":"var(--ast-global-color-5)","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""}},"footnotes":""},"categories":[14,12,10],"tags":[],"class_list":["post-241","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-demos","category-scalerichview","category-trichview"],"uagb_featured_image_src":{"full":["https:\/\/www.trichview.com\/wp\/wp-content\/uploads\/2022\/01\/PageBackgroundScaleRichView.png",509,760,false],"thumbnail":["https:\/\/www.trichview.com\/wp\/wp-content\/uploads\/2022\/01\/PageBackgroundScaleRichView-150x150.png",150,150,true],"medium":["https:\/\/www.trichview.com\/wp\/wp-content\/uploads\/2022\/01\/PageBackgroundScaleRichView-201x300.png",201,300,true],"medium_large":["https:\/\/www.trichview.com\/wp\/wp-content\/uploads\/2022\/01\/PageBackgroundScaleRichView.png",509,760,false],"large":["https:\/\/www.trichview.com\/wp\/wp-content\/uploads\/2022\/01\/PageBackgroundScaleRichView.png",509,760,false],"1536x1536":["https:\/\/www.trichview.com\/wp\/wp-content\/uploads\/2022\/01\/PageBackgroundScaleRichView.png",509,760,false],"2048x2048":["https:\/\/www.trichview.com\/wp\/wp-content\/uploads\/2022\/01\/PageBackgroundScaleRichView.png",509,760,false]},"uagb_author_info":{"display_name":"Sergey Tkachenko","author_link":"https:\/\/www.trichview.com\/wp\/author\/sergey-tkachenko\/"},"uagb_comment_info":0,"uagb_excerpt":"Microsoft Word Documents (DocX and RTF) do not support page background directly.However, there is a workaround: you can insert a text box in a header or a footer, and add an image to this textbox. Additionally, this textbox can have a border.Actually, Microsoft Word itself uses this technique when adding a page watermark. The demo&hellip;","post_mailing_queue_ids":[],"_links":{"self":[{"href":"https:\/\/www.trichview.com\/wp\/wp-json\/wp\/v2\/posts\/241","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.trichview.com\/wp\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.trichview.com\/wp\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.trichview.com\/wp\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.trichview.com\/wp\/wp-json\/wp\/v2\/comments?post=241"}],"version-history":[{"count":1,"href":"https:\/\/www.trichview.com\/wp\/wp-json\/wp\/v2\/posts\/241\/revisions"}],"predecessor-version":[{"id":243,"href":"https:\/\/www.trichview.com\/wp\/wp-json\/wp\/v2\/posts\/241\/revisions\/243"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/www.trichview.com\/wp\/wp-json\/wp\/v2\/media\/242"}],"wp:attachment":[{"href":"https:\/\/www.trichview.com\/wp\/wp-json\/wp\/v2\/media?parent=241"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.trichview.com\/wp\/wp-json\/wp\/v2\/categories?post=241"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.trichview.com\/wp\/wp-json\/wp\/v2\/tags?post=241"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}