privateOmega/html-to-docx

Unable to put footer text on same line as page number

Opened this issue · 4 comments

Hello,

I am trying to write a document and, on the footer, would like to have the page number (in the middle) and the current data on the left hand side. I have this request but is putting date on one line and page number on other line. Any help is much appreciated:

      const footerString = `
        <div>
          <span style="text-align: center;"></span>
          <span style="text-align: left;">${new Date().toISOString()}</span>
        </div>
        `;
    const fileBuffer = await HTMLtoDOCX('<body></body>', null, {
      font: "Helvetica",
      footer: true,
      pageNumber: true,
    }, footerString);

Note: page number is automatically added to the first span, not sure how but it works.

i got same issue...

@privateOmega Could you please help us understand what is going on here? This is a kind of blocker issue for us. Thanks.

@andyrewwer @lignar-fazmin @ansal-exp Sorry guys that I didnt notice this issue for this long, unfortunately the way that page numbers are inserted is, it is inserted as last element into first paragraph tag (or its equivalent).

const footerString = <p>${new Date().toISOString()} | </p>;

This should put the date and page number into the same line as you guys hoped for I believe, unfortunately I am not in a position to commit time into this project at present.

Hi guys!
Excuse me... Could you solve it? I have the same problem.