davidgohel / flextable

table farming
https://ardata-fr.github.io/flextable-book/
554 stars 79 forks source link

Allow captions and footers to extend beyond the table without wrapping #551

Closed ameekbhalla closed 1 year ago

ameekbhalla commented 1 year ago

Hi,

The footers and captions may look better if they are forced to stay in a single line, especially for narrow tables as here.

tibble::tribble(
             ~"Trait",              ~"Diagnostic threshold",
  "Waist circumference",              "> 94 cm in men",
                     NA,              "> 80 cm in women",
       "Blood pressure",              "> 130 mm Hg systolic",
                     NA,              ">  85 mm Hg diastolic",
        "Triglycerides",              "> 150 mg/dL",
                "HDL-C",              "< 40 mg/dL in men",
                     NA,              "< 50 mg/dL in women",
      "Fasting glucose",              "100 mg/dL"
  ) |> 
  flextable() |> 
  set_caption("The cluster of traits used for diagnosing metabolic syndrome.", 
              align_with_table = F, 
              fp_p = officer::fp_par(text.align = "left", padding = 3)
              ) |> 
  add_footer_lines(values = "Abbreviations: HDL-C, high-density lipoprotein cholesterol.") |> 
  set_table_properties(layout = "autofit")

Thanks for the great packages!

davidgohel commented 1 year ago

Hello,

For that, you just need to add a paragraph. Add a paragraph and that's it.

github-actions[bot] commented 8 months ago

This old thread has been automatically locked. If you think you have found something related to this, please open a new issue and link to this old issue if necessary.