我想在<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
<ul>
<li class="btn checkall">
<input type="checkbox" name="offer[key1]" class="check_one">
<input type="checkbox" name="offer[key2]" class="check_one">
<input type="checkbox" name="offer[key3]" class="check_one">
<input type="checkbox" name="offer[key4]" class="check_one">
</li>
<li class="btn checkall">
<input type="checkbox" name="offer[key1]" class="check_one">
<input type="checkbox" name="offer[key2]" class="check_one">
<input type="checkbox" name="offer[key3]" class="check_one">
<input type="checkbox" name="offer[key4]" class="check_one">
</li>
<li class="btn checkall">
<input type="checkbox" name="offer[key1]" class="check_one">
<input type="checkbox" name="offer[key2]" class="check_one">
<input type="checkbox" name="offer[key3]" class="check_one">
<input type="checkbox" name="offer[key4]" class="check_one">
</li>
<li class="btn checkall">
<input type="checkbox" name="offer[key1]" class="check_one">
<input type="checkbox" name="offer[key2]" class="check_one">
<input type="checkbox" name="offer[key3]" class="check_one">
<input type="checkbox" name="offer[key4]" class="check_one">
</li>
</ul>
(开始)内部将文本设置为文档中另一个具体XWPFParagraph
(结束)的超链接。我找到了一个代码来在XWPFParagraph
内创建超链接,但它无效(启动链接开始):
XWPFCell
答案 0 :(得分:1)
我终于做到了。最初的想法是创建一个从XWPFParagraph到另一个XWPFParagraph的超链接,但由于我将始终链接到文档中具有唯一文本的段落,我发现它是这样的:
private static void createHyperLink(XWPFParagraph start, String startTxt, String endTxt) {
// Creating the hyperlink in the start paragraph
CTHyperlink cLink = start.getCTP().addNewHyperlink();
// Link to the end text in the doc
cLink.setAnchor(endTxt);
// Creating the String that will have the hyperlink
CTText ctText = CTText.Factory.newInstance();
ctText.setStringValue(startTxt);
CTR ctr=CTR.Factory.newInstance();
ctr.setTArray(new CTText[]{ctText});
// Inserting the String in the doc
cLink.setRArray(new CTR[]{ctr});
}