Where communities thrive


  • Join over 1.5M+ people
  • Join over 100K+ communities
  • Free without limits
  • Create your own community
People
Activity
  • Nov 13 02:07
    Krudff starred dolanmiu/docx
  • Nov 12 10:12
    Sraleik commented #448
  • Nov 12 09:09
    Sraleik commented #448
  • Nov 12 00:53

    dolanmiu on gh-pages

    Deploy dolanmiu/docx to github.… (compare)

  • Nov 12 00:49
    dolanmiu commented #390
  • Nov 12 00:49
    dolanmiu commented #440
  • Nov 12 00:48
    dolanmiu closed #440
  • Nov 12 00:48
    dolanmiu commented #440
  • Nov 12 00:48
    dolanmiu commented #448
  • Nov 12 00:48

    dolanmiu on master

    fix hyperlink id fix lint Merge pull request #448 from Sr… (compare)

  • Nov 12 00:48
    dolanmiu closed #448
  • Nov 11 20:05
    yasaricli starred dolanmiu/docx
  • Nov 11 15:08
    dannycornelisseMT commented #390
  • Nov 10 23:27
    bruinspaw starred dolanmiu/docx
  • Nov 10 22:00
    dolanmiu commented #390
  • Nov 10 10:05
    omgovich commented #390
  • Nov 10 10:04
    omgovich commented #390
  • Nov 10 10:03
    omgovich commented #390
  • Nov 10 10:00
    omgovich commented #390
  • Nov 09 16:38
    dolanmiu labeled #449
Twitch
@franztango_twitter
how to change the width of a table?
Rishabh Madan
@rishtech20
I am trying to add images in a docx file using a loop, the first image is not displayed whereas the others get displayed just fine. Office gives an error saying that file might be corrupted. Any suggestions?
for (let i = 0; i < data.coverages.length; i++) {
// //doc
// .createParagraph(data.coverages[i].headline)
// .style("indexHeadingStyle")
// .spacing({
// before: 200,
// after: 800
// });
const image = docx.Media.addImage(
doc,
fs.readFileSync("awesome-pictures-32-1.jpg")
);
doc.addImage(image);
//doc.createParagraph("").pageBreak();
}
Rishabh Madan
@rishtech20
Quick fix that I found was this:
docx.Media.addImage(doc);
for (let i = 0; i < data.coverages.length; i++) {
// //doc
// .createParagraph(data.coverages[i].headline)
// .style("indexHeadingStyle")
// .spacing({
// before: 200,
// after: 800
// });
const image2 = docx.Media.addImage(
doc,
fs.readFileSync("awesome-pictures-32-1.jpg")
);
doc.addImage(image2);
//doc.createParagraph("").pageBreak();
}
Seems like a bug
Dolan
@dolanmiu
table widths are currently being re-done as of v5
at the moment table widths are weirdly implemented
i will look into this bug
David
@ditiem
Please, @dolanmiu, have a quick look to the header issue i mentioned on Feb 07. I think it is a nonsense and it should be easy to fix. If you dont have time I will look into it once I release the project I am currently working on.
Dolan
@dolanmiu
ok ill have a look into this too
Dolan
@dolanmiu
ok @ditiem seems like its a bug
will work on it for the v5 release asap
leave this one to me, i want to re-design the api of it a little. I am not liking the doc.createFirstPageHeader(); doc.createEvenPageHeader(); doc.createHeader(); methods
seems confusing
Rishabh Madan
@rishtech20
Is there any way to add border to the images?
Dolan
@dolanmiu
not yet im afraid
Ky
@ky-cheng
Is there a way to insert url hyperlink to the document?
Ky
@ky-cheng
Nevermind, I work out you can use document.createHyperlink(), sorry I didn't see an example in documentation site so couldn't find it earlier. Thanks.
Dolan
@dolanmiu
Yup that is right
Sorry for the late reply
Ky
@ky-cheng
All good! Thank you for this great package! Happy weekend :)
DennisAtDept
@DennisAtDept
image.png

Hi all,

Is there any way to add a table style to a table like you can with paragraphs?

.e.g:
new Paragraph().style("My Paragraph style"); works

but
new Table().style("My table style"); is not supported

I know you can add styling per cell which works fine, but sometimes i want to add additional lines to a table in word after the document is generated.
Word is not smart enough alterate between the styling of even and uneven rows.

To be able to just use the ootb styles available in word is more then enough for my purposes

image.png
Dolan
@dolanmiu
This might be a feature request, I haven’t explored styles in tables yet, but adding borders is possible
DennisAtDept
@DennisAtDept

Hi Dolan,

Thank you for the quick reply, setting the borders and background colours of the cells is indeed possible, but when the person generating these documents wants to adds additional rows to the table, the background colours of the additional rows matches the row that is generated as last instead of alternating between two colours.

I will see if i can add a feature request :)

Using a existing table style or some option to define alternating table row colours is good enough.

DennisAtDept
@DennisAtDept
I'm sorry, what is the propper way to add a feature request?
Dolan
@dolanmiu
Proper way to request a feature is to create an issue on GitHub! :)
Carl Block
@carlblock
Is there someway to insert paragraphs into an already created section?
Something like this? doc.document.body.sections[0].children.push(new Paragraph("Hello"));
Carl Block
@carlblock
@dolanmiu Sorry for doing a mention, I just realised this gitter seems very inactive since July. Is there another more active place for questions?
Dolan
@dolanmiu
GitHub issues
Should probs use this chat more though
Carl Block
@carlblock
Okay, I was thinking that but I'm just afraid of "littering" of non-issues
Dolan
@dolanmiu
And no, there’s no way (and shouldn’t be) a way to add paragraphs to an existing section
Carl Block
@carlblock
Okay
Dolan
@dolanmiu
Gitter is buggy on iOS, I can’t access Gitter on my computer at work, blocked
Carl Block
@carlblock
Because I'm doing a recursive function to create a tree of some HTML content to recreate it with docxjs
Dolan
@dolanmiu
You can create the section object, then at the final recursion step do a doc.addSection
Carl Block
@carlblock
Basically converting quite simple HTML DOM to a docxjs document. I've already managed to create a JSON representation of the DOM. But I thought I could apply the same method to construct a docxjs
That's true, didn't think about that :)
Dolan
@dolanmiu
Why not separate your concerns so you have a two step process? It will be healthier for the codebase Have the recursion step to create the data you need, then have a “docx” step to create the word document
Carl Block
@carlblock
That does indeed seem better
Dolan
@dolanmiu
Mixing in concerns in general makes headaches for other devs (and your future self) reading the code :wink:
Cool, hope I helped, I’ll use this chat more often in future
Carl Block
@carlblock
Yeah you did! Thanks a lot, if I succeed to make a neat HTML -> docxjs module I could post it in the issues for others to take some inspo later on
Dolan
@dolanmiu
do you mind if I add your company name on the README? @carlblock
Carl Block
@carlblock
@dolanmiu Sure no problem! :)
Dolan
@dolanmiu
What is the company?
Carl Block
@carlblock
herraizsoto&co.