Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Captions within tables and List of Tables #82

Open
symeonmattes opened this issue Feb 28, 2022 · 0 comments
Open

Captions within tables and List of Tables #82

symeonmattes opened this issue Feb 28, 2022 · 0 comments

Comments

@symeonmattes
Copy link

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

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

No branches or pull requests

1 participant