summaryrefslogtreecommitdiffhomepage
path: root/examples/wrap_text_example.md
diff options
context:
space:
mode:
Diffstat (limited to 'examples/wrap_text_example.md')
-rw-r--r--examples/wrap_text_example.md26
1 files changed, 26 insertions, 0 deletions
diff --git a/examples/wrap_text_example.md b/examples/wrap_text_example.md
new file mode 100644
index 00000000..caa75b17
--- /dev/null
+++ b/examples/wrap_text_example.md
@@ -0,0 +1,26 @@
+## Description
+
+Set text wrapping from the styles
+
+## Code
+
+```ruby
+require 'axlsx'
+
+p = Axlsx::Package.new
+wb = p.workbook
+s = wb.styles
+
+wrap_text = s.add_style alignment: { wrap_text: true }
+
+wb.add_worksheet(name: 'Wrap Text') do |sheet|
+ sheet.add_row ['First, Second and Third'], style: wrap_text
+ sheet.column_widths 9
+end
+
+p.serialize 'wrap_text_example.xlsx'
+```
+
+## Output
+
+![Output](images/wrap_text_example.png "Output")