# html-diff-util
**Repository Path**: mgicode/html-diff-util
## Basic Information
- **Project Name**: html-diff-util
- **Description**: html对比工具
- **Primary Language**: Java
- **License**: Not specified
- **Default Branch**: master
- **Homepage**: None
- **GVP Project**: No
## Statistics
- **Stars**: 0
- **Forks**: 15
- **Created**: 2024-06-07
- **Last Updated**: 2024-06-07
## Categories & Tags
**Categories**: Uncategorized
**Tags**: None
## README
# html对比差异
1. `新增数据`
2. `删除数据`
3. `修改数据`
4. `对调数据`
5. `移动数据`
### 效果图
html1:

html2:

对比结果:

### 使用
```java
public class DemoTest {
@Test
public void testHtmlDiff() throws Exception {
String htmlOld = MyFileUtil.readFileContent(AppConstant.PROJECT_ROOT_DIRECTORY + "/test1.html");
String htmlNew = MyFileUtil.readFileContent(AppConstant.PROJECT_ROOT_DIRECTORY + "/test2.html");
DiffBO diffData = MyDiffHtmlUtil.getDiffData(DiffTextInfoHandleBO.builder()
.checkedDiffTypeList(
Lists.newArrayList(DiffTypeEnum.增加.getType(), DiffTypeEnum.删除.getType(),
DiffTypeEnum.修改.getType(), DiffTypeEnum.对调.getType(), DiffTypeEnum.移动.getType()))
.htmlOld(htmlOld).htmlNew(htmlNew).build());
String diffContentHtml = diffData.getDiffContentHtml();
List diffShowList = diffData.getDiffShowList();
DiffTextStatisticsInfoBO diffTextStatisticsInfo = diffData.getDiffTextStatisticsInfo();
MyFileUtil.writeFileContent(diffContentHtml, AppConstant.PROJECT_ROOT_DIRECTORY + "/diff.html");
}
}
```