Skip to content

Captions within tables and List of Tables  #82

Description

I'm using docx4j and docx4j-ImportXHTML in order to convert an xhtml to docx4j classes and get a document.

In my xhtml file I have table with captions, i.e.

<table>
<caption>My caption</caption>
<tr>
<td>val1</td>
<td>val2</td>
</tr>
</table>

I would like to add captions with sequence inside in order to create a list of table. However the caption seems to be ignored and it doesn't create the element I'm interested in.

From docx if I unzip it and have a caption that I have inserted through docx4j, I get;

		<w:p>
			<w:pPr>
				<w:pStyle w:val="Caption"/>
			</w:pPr>
			<w:r>
				<w:t xml:space="preserve">Table </w:t>
			</w:r>
			<w:fldSimple w:instr=" SEQ Table \* ARABIC ">
				<w:r>
					<w:rPr>
						<w:noProof/>
					</w:rPr>
					<w:t>1</w:t>
				</w:r>
			</w:fldSimple>
			<w:r>
				<w:t xml:space="preserve"> Table with Caption</w:t>
			</w:r>
			<w:r>
				<w:rPr>
					<w:rFonts w:ascii="Calibri" w:hAnsi="Calibri"/>
					<w:b w:val="0"/>
					<w:color w:val="000000"/>
					<w:sz w:val="22"/>
				</w:rPr>
				<w:t> </w:t>
			</w:r>
		</w:p>
		

While the xml for caption label has been translated to:

					<w:tr>
				<w:trPr>
					<w:gridAfter w:val="1"/>
					<w:wAfter w:w="1335" w:type="dxa"/>
				</w:trPr>
				<w:tc>
					<w:tcPr>
						<w:tcW w:w="0" w:type="auto"/>
					</w:tcPr>
					<w:p>
						<w:pPr>
							<w:spacing w:after="0"/>
							<w:ind w:left="120"/>
							<w:jc w:val="center"/>
						</w:pPr>
						<w:r>
							<w:rPr>
								<w:rFonts w:ascii="Calibri" w:hAnsi="Calibri"/>
								<w:color w:val="000000"/>
							</w:rPr>
							<w:t xml:space="preserve"> Table with caption </w:t>
						</w:r>
					</w:p>
				</w:tc>
			</w:tr>

Is there any way to get the first or if this feature is going to be implemented in the future

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions