Ziv-Barber / officegen

Standalone Office Open XML files (Microsoft Office 2007 and later) generator for Word (docx), PowerPoint (pptx) and Excell (xlsx) in javascript. The output is a stream.
MIT License
2.65k stars 471 forks source link

hello!! How to add line-height when addText for ppt ??? #298

Open lessgx opened 5 years ago

lessgx commented 5 years ago

Environment

  1. node -v: [fill]
  2. npm -v: [fill]
  3. npm ls officegen: [fill]
  4. Operating system: [fill]
  5. Microsoft Office version: [fill]
  6. Problem with Powerpoint, Excel or Word document: [fill]

Steps to Reproduce

[fill]

Expected Behavior

[fill]

Actual Behavior

[fill]


An example code will be the best. The fastest (and the most fun) way to resolve the issue is to submit a pull-request yourself.

Ziv-Barber commented 5 years ago

See this example:

// Add text box with multi colors and fonts: slide.addText( [ { text: 'Hello ', options: { font_size: 56 } }, { text: 'World!', options: { font_size: 56, font_face: 'Arial', color: 'ffff00' } } ], { cx: '75%', cy: 66, y: 150 } )

You can add an array to addText when each object has the following data members:

text - the text to add. options - list of options.

options:

font_size = the font size font_face = the font to use color = color and so on... (I'm working right now on the documentation to document everything).

The 2nd parameter to addText is an object with global setting to all the parts of the text to add:

x = x position y = y position cx = text area box size x cy = text area box size y color = global color font_size font_face bold = true or false underline = true or false align and so

thanks, Ziv

On Thu, Mar 28, 2019 at 3:26 AM lessgx notifications@github.com wrote:

Environment

  1. node -v: [fill]
  2. npm -v: [fill]
  3. npm ls officegen: [fill]
  4. Operating system: [fill]
  5. Microsoft Office version: [fill]
  6. Problem with Powerpoint, Excel or Word document: [fill]

Steps to Reproduce

[fill] Expected Behavior

[fill] Actual Behavior

[fill]

An example code will be the best. The fastest (and the most fun) way to resolve the issue is to submit a pull-request yourself.

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/Ziv-Barber/officegen/issues/298, or mute the thread https://github.com/notifications/unsubscribe-auth/ADf3MfUGJRy0WlxtLn50GHHS1q4tABSUks5vbChzgaJpZM4cPJfK .

lessgx commented 5 years ago

I see what you mean. thank you very much! ^_^ but sometime i want to add a long Text ,(the length of it is longer than ' cx ' ) How do I add line spacing between the two rows?

For example: I want this effect ( by using once addText ) aaaaaaaaaaaaaaaa

aaaaaaaaaaaaa

but It doesn't seem to have that effect(too close) aaaaaaaaaaaaaaaa aaaaaaaaaaaaa

I try to use too many addText with different ' y ' to achieve it .
Is there any better way to do that?

Eagerly awaiting your reply. thank you

Ziv-Barber commented 5 years ago

Right now it's not easy to do it but I'm planing to add a better support. You can use new line in the addText string and I'll split it into 2 strings internally (it's working right now).

Ziv

On Fri, Mar 29, 2019 at 2:51 AM lessgx notifications@github.com wrote:

I see what you mean. thank you very much! ^_^ but sometime i want to add a long Text ,(the length of it is longer than ' cx ' ) How do I add line spacing between the two rows?

For example: I want this effect ( by using once addText ) aaaaaaaaaaaaaaaa

aaaaaaaaaaaaa

but It doesn't seem to have that effect(too close) aaaaaaaaaaaaaaaa aaaaaaaaaaaaa

I try to use too many addText with different ' y ' to achieve it . Is there any better way to do that?

Eagerly awaiting your reply. thank you

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/Ziv-Barber/officegen/issues/298#issuecomment-477834723, or mute the thread https://github.com/notifications/unsubscribe-auth/ADf3MZrMG4Dmrdgc7I32n6u7MnN6d7Cmks5vbXGhgaJpZM4cPJfK .

lessgx commented 5 years ago

Nice, thank you.