Skip to content

Add Run.AddTab() for inserting tab characters#87

Open
theAstiv wants to merge 1 commit into
gomutex:mainfrom
theAstiv:feat/run-add-tab
Open

Add Run.AddTab() for inserting tab characters#87
theAstiv wants to merge 1 commit into
gomutex:mainfrom
theAstiv:feat/run-add-tab

Conversation

@theAstiv
Copy link
Copy Markdown

Summary

  • Adds Run.AddTab(), which inserts a <w:tab/> element into a run.
  • The underlying ctypes plumbing (RunChild.Tab, marshal, unmarshal) was already present; this exposes a public helper on docx.Run consistent with Bold, Italic, Underline, etc.

Motivation

Users wanting tab characters in a run currently have to drop to ctypes directly. python-docx, the inspiration for this library per the README, exposes run.add_tab() as a first-class helper.

Changes

  • docx/run.go: new AddTab() method, returns *Run for chaining (consistent with the other chainable *Run methods in this file).
  • docx/run_test.go: new file with two test cases — single tab with marshal assertion, and chained multi-tab.

Testing

  • go test ./... passes (including existing determinism tests)
  • go vet ./... clean
  • gofmt clean

This exposes a public helper on docx.Run consistent with Bold, Italic, Underline, etc.
Returns *Run for chaining.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant