Skip to content

Commit

Permalink
Merge branch 'refs/heads/feature/4.5.2' into feature/4.5.3
Browse files Browse the repository at this point in the history
# Conflicts:
#	pom.xml
  • Loading branch information
liaochong committed Oct 10, 2024
2 parents 92e96cf + 5a7b447 commit 70263a6
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 5 deletions.
2 changes: 1 addition & 1 deletion example/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@
<dependency>
<groupId>com.github.liaochong</groupId>
<artifactId>myexcel</artifactId>
<version>4.3.3</version>
<version>4.5.2</version>
</dependency>
<dependency>
<groupId>org.apache.logging.log4j</groupId>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
*/
package com.github.liaochong.myexcel.core.parser;

import com.github.liaochong.myexcel.core.PromptContainer;
import com.github.liaochong.myexcel.core.constant.Constants;
import com.github.liaochong.myexcel.core.style.FontStyle;
import com.github.liaochong.myexcel.utils.ImageUtil;
Expand Down Expand Up @@ -233,11 +234,25 @@ private void parseTdOfTr(Tr tr, Element trElement, Map<String, String> trStyle,
this.setColumnWidth(colWidthMap, td);
// 批注
this.setComment(tdElement, td);
// 提示
this.setPrompt(tdElement, td);
}
tr.tdList = tdList;
tr.colWidthMap = colWidthMap;
}

private void setPrompt(Element tdElement, Td td) {
String title = tdElement.attr("prompt-title");
String text = tdElement.attr("prompt-text");
if (StringUtil.isBlank(title) || StringUtil.isBlank(text)) {
return;
}
PromptContainer promptContainer = new PromptContainer();
promptContainer.title = title;
promptContainer.text = text;
td.promptContainer = promptContainer;
}

private void setComment(Element tdElement, Td td) {
String commentText = tdElement.attr("comment-text");
String author = tdElement.attr("comment-author");
Expand Down
8 changes: 4 additions & 4 deletions src/test/resources/templates/freemarkerToExcelExample.ftl
Original file line number Diff line number Diff line change
Expand Up @@ -20,12 +20,12 @@
<tr>
<td double>3,123.09</td>
<td style="word-break: break-all">2<br/>676878>.~</td>
<td>爱新觉罗·玄烨</td>
<td prompt-title="提示" prompt-text="小提示1">爱新觉罗·玄烨</td>
</tr>
<tr style="height: 100px;">
<td>1</td>
<td>2</td>
<td>3</td>
<td dropdownlist dropdownlist-name="省份">浙江,江西</td>
<td dropdownlist dropdownlist-name="市区" dropdownlist-parent="省份">南昌,杭州,宁波</td>
<td dropdownlist dropdownlist-parent="市区">上城区,下城区,弋阳,横峰</td>
</tr>
<tr style="background-color:red">
<td colspan="3"><a href="http://www.baidu.com">百度链接</a></td>
Expand Down

0 comments on commit 70263a6

Please sign in to comment.