mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-07-09 03:04:10 -04:00
Ensure there is never a blank page at the start of the generated docx file
This commit is contained in:
parent
2160cbaecf
commit
5b1d5c5a81
@ -110,6 +110,7 @@ class Block(object):
|
|||||||
self.namespace = namespace
|
self.namespace = namespace
|
||||||
self.bookmarks = set()
|
self.bookmarks = set()
|
||||||
self.list_tag = (html_block, style) if is_list_item else None
|
self.list_tag = (html_block, style) if is_list_item else None
|
||||||
|
self.is_first_block = False
|
||||||
self.numbering_id = None
|
self.numbering_id = None
|
||||||
self.parent_items = None
|
self.parent_items = None
|
||||||
self.html_block = html_block
|
self.html_block = html_block
|
||||||
@ -186,6 +187,8 @@ class Block(object):
|
|||||||
makeelement(numpr, 'w:ilvl', w_val=str(self.numbering_id[1]))
|
makeelement(numpr, 'w:ilvl', w_val=str(self.numbering_id[1]))
|
||||||
makeelement(numpr, 'w:numId', w_val=str(self.numbering_id[0]))
|
makeelement(numpr, 'w:numId', w_val=str(self.numbering_id[0]))
|
||||||
makeelement(ppr, 'w:pStyle', w_val=self.style.id)
|
makeelement(ppr, 'w:pStyle', w_val=self.style.id)
|
||||||
|
if self.is_first_block:
|
||||||
|
makeelement(ppr, 'w:pageBreakBefore', w_val='off')
|
||||||
for run in self.runs:
|
for run in self.runs:
|
||||||
run.serialize(p, self.links_manager)
|
run.serialize(p, self.links_manager)
|
||||||
for bmark in end_bookmarks:
|
for bmark in end_bookmarks:
|
||||||
@ -347,6 +350,7 @@ class Convert(object):
|
|||||||
remove_blocks.append((i, block))
|
remove_blocks.append((i, block))
|
||||||
for pos, block in reversed(remove_blocks):
|
for pos, block in reversed(remove_blocks):
|
||||||
self.blocks.delete_block_at(pos)
|
self.blocks.delete_block_at(pos)
|
||||||
|
self.blocks.all_blocks[0].is_first_block = True
|
||||||
|
|
||||||
self.lists_manager.finalize(all_blocks)
|
self.lists_manager.finalize(all_blocks)
|
||||||
self.styles_manager.finalize(all_blocks)
|
self.styles_manager.finalize(all_blocks)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user