mirror of
https://github.com/unidoc/unipdf.git
synced 2025-05-07 19:29:16 +08:00
Add AddTextItem method on the list component
This commit is contained in:
parent
ff8557824c
commit
2932b81dc2
@ -86,6 +86,20 @@ func (l *List) Add(item VectorDrawable) (*TextChunk, error) {
|
||||
return &listItem.marker, nil
|
||||
}
|
||||
|
||||
// AddTextItem appends a new item with the specified text to the list.
|
||||
// The method creates a styled paragraph with the specified text and returns
|
||||
// it so that the item style can be customized.
|
||||
// The method also returns the marker used for the newly added item.
|
||||
// The marker object can be used to change the text and style of the marker
|
||||
// for the current item.
|
||||
func (l *List) AddTextItem(text string) (*StyledParagraph, *TextChunk, error) {
|
||||
item := newStyledParagraph(l.defaultStyle)
|
||||
item.Append(text)
|
||||
|
||||
marker, err := l.Add(item)
|
||||
return item, marker, err
|
||||
}
|
||||
|
||||
// Marker returns the marker used for the list items.
|
||||
// The marker instance can be used the change the text and the style
|
||||
// of newly added list items.
|
||||
|
Loading…
x
Reference in New Issue
Block a user