Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Word report: justify text orientation #747

Closed
PavelBal opened this issue Mar 31, 2022 · 9 comments
Closed

Word report: justify text orientation #747

PavelBal opened this issue Mar 31, 2022 · 9 comments

Comments

@PavelBal
Copy link
Member

image

vs

image

@Yuri05
Copy link
Member

Yuri05 commented Mar 31, 2022

I don't see a difference...
Apart from that: s. #748 (comment)

@PavelBal
Copy link
Member Author

image

vs

image

"Justify" looks calmer.

@Yuri05
Copy link
Member

Yuri05 commented Mar 31, 2022

Still don't understand the issue. Are you complaining about the text font?

@PavelBal
Copy link
Member Author

No, text alignment:

image

it is "Left" by default, I propose "Justify"

@Yuri05
Copy link
Member

Yuri05 commented Mar 31, 2022

Ok, got it know. Never knew that option is called "Justify" :)
Then... the same as for all other Word formatting applies: #748 (comment)

@pchelle
Copy link
Collaborator

pchelle commented Dec 13, 2022

Setting default alignment to Justify can be done by Modifying the styles of the reference document.

After some investigation, it is also possible to create new styles in the docx reference document with specific alignments (left, center, right, justify).
These custom styles can then be included in the markdown document as suggested by the Pandoc documentation and applied to the word report by Pandoc.

For instance, if you create a style named "Centered" in your reference document that use a center alignment, the line below in the markdown document will create a centered paragraph.

::: {custom-style="Centered"}
Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua.
:::

pchelle added a commit to pchelle/OSPSuite.ReportingEngine that referenced this issue Dec 22, 2022
…n-Systems-Pharmacology#748 Open-Systems-Pharmacology#749 Open-Systems-Pharmacology#750 Open-Systems-Pharmacology#754 default reference document styles

In the new reference document
- Default line spacing is 1.5
- Default font is Arial and not bold
- Default alignment is Justify
- Tables use borders, first row and column only in bold
pchelle added a commit to pchelle/OSPSuite.ReportingEngine that referenced this issue Dec 22, 2022
Yuri05 pushed a commit that referenced this issue Jan 2, 2023

Verified

This commit was created on GitHub.com and signed with GitHub’s verified signature. The key has expired.
* Fixes #963 Adapt pandoc options to version

* Fixes #746 #747 #748 #749 #750 #754 default reference document styles

In the new reference document
- Default line spacing is 1.5
- Default font is Arial and not bold
- Default alignment is Justify
- Tables use borders, first row and column only in bold

* Unfix #747 back to left aligned paragraphs
@pchelle
Copy link
Collaborator

pchelle commented Jun 15, 2023

@PavelBal
Working on documenting the word template on PR #1065
I found that you can use the following raw code block to justify a paragraph before conversion to docx

```{=openxml}
<w:pPr>
<w:jc w:val="both"/>
</w:pPr>
```

@pchelle
Copy link
Collaborator

pchelle commented Jun 15, 2023

Following up on that if we want to implement at some point.
Adding raw openxml in the markdown isn't great.
However html tags works in markdown and could be internally translated into raw openxml before conversion (this is already the workflow for subscript and superscript btw)

The user or RE would only have to create for instance

<div align="right"> This is right aligned text </div>

translated into this

`<w:pPr><w:jc w:val="right"/></w:pPr>`{=openxml}This is right aligned text

and rendering specified align text in both documents

This is right aligned text

Also, translation of div alignment to inline raw openxml also works for tables

|header 1|<div align="right"> long header 2 </div>|<div align="center"> very long header 3 </div>|
|----|-----|-----|
|a     |<div align="right"> b </div>  | <div align="center"> c </div> |

translated into this

|header 1|`<w:pPr><w:jc w:val="right"/></w:pPr>`{=openxml} long header 2 |`<w:pPr><w:jc w:val="center"/></w:pPr>`{=openxml} very long header 3|
|----|-----|-----|
|a     |`<w:pPr><w:jc w:val="right"/></w:pPr>`{=openxml} b |`<w:pPr><w:jc w:val="center"/></w:pPr>`{=openxml} c |

and rendering specified alignments in tables of both documents

header 1
long header 2
very long header 3
a
b
c

@pchelle
Copy link
Collaborator

pchelle commented Mar 22, 2024

Fixed by PR #1065

There is an article documenting how to leverage html tags for word conversion

@pchelle pchelle closed this as completed Mar 22, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants