Skip to content

How can I create a truly transparent TextBox (no white fill)? #3119

Answered by rk250ky
rk250ky asked this question in Q&A
Discussion options

You must be logged in to vote

maybe not best solution but fixed it by fetching and patching object xml. Replaced parts that needed change with this logic:

` const patchedXml = documentXml.replace(/<v:shape([^>]*?)>/g, (match, existingAttrs) => {
let attrs = existingAttrs;

  if (!/filled="f"/.test(attrs)) attrs += ' filled="f"';
  if (!/stroked="f"/.test(attrs)) attrs += ' stroked="f"';

  if (/style="([^"]*)"/.test(attrs)) {
    attrs = attrs.replace(/style="([^"]*)"/, (m, styleContent) => {
      let updatedStyle = styleContent;
      if (!/mso-wrap-style:/.test(updatedStyle)) updatedStyle += ';mso-wrap-style:behind';
      return `style="${updatedStyle}"`;
    });
  } else {
    attrs += ' style="position:absolute;z…

Replies: 1 comment

Comment options

You must be logged in to vote
0 replies
Answer selected by rk250ky
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
1 participant