| categories |
|
||||
|---|---|---|---|---|---|
| date | 2025-12-31 | ||||
| description | GroupDocs.Comparison for Java๋ฅผ ์ฌ์ฉํ์ฌ Java์์ Excel ํ์ผ ๋ฐ ๊ธฐํ ๋ฌธ์๋ฅผ ๋น๊ตํ๋ ๋ฐฉ๋ฒ์ ๋ฐฐ์๋๋ค. ์ฌ๊ธฐ์๋ PDF ๋ฌธ์ ๋น๊ต Java, ๋์ฉ๋ ๋ฌธ์ ๋น๊ต Java, ์ํธํ๋ PDF ๋น๊ต Java ์์ ๊ฐ ํฌํจ๋ฉ๋๋ค. | ||||
| keywords | java compare excel files, compare pdf documents java, java compare large documents, java compare encrypted pdf, GroupDocs.Comparison Java | ||||
| lastmod | 2025-12-31 | ||||
| linktitle | Java Compare Excel Files Guide | ||||
| tags |
|
||||
| title | Document Comparison API๋ฅผ ์ฌ์ฉํ Java Excel ํ์ผ ๋น๊ต | ||||
| type | docs | ||||
| url | /ko/java/basic-comparison/mastering-document-comparison-java-groupdocs/ | ||||
| weight | 1 |
๋ฌธ์๋ฅผ ์๋์ผ๋ก ์ผ์ผ์ด ๋น๊ตํ๋ฉฐ ๋ณ๊ฒฝ ์ฌํญ์ ํ ์ค์ฉ ์ฐพ์๋ณด๋๋ผ ๋ช ์๊ฐ์ ๋ณด๋ธ ์ ์ด ์๋์? ๊ณ์ฝ ์์ ์ฌํญ์ ์ถ์ ํ๊ฑฐ๋ ์ฝ๋ ๋ฌธ์๋ฅผ ๊ฒํ ํ๊ฑฐ๋ ์ฌ๋ฌด ๋ณด๊ณ ์๋ฅผ ์ํ java compare excel files๋ฅผ ์ํํ๋ , ์๋ ๋ฌธ์ ๋น๊ต๋ ์๊ฐ๋ ๋ง์ด ๊ฑธ๋ฆฌ๊ณ ์ค๋ฅ๊ฐ ๋ฐ์ํ๊ธฐ ์ฝ์ต๋๋ค.
GroupDocs.Comparison for Java API๋ ์ ๋ฐํ ์๋ ๋ฌธ์ ๋น๊ต๋ฅผ ์ ๊ณตํ์ฌ ์ด ๋ฌธ์ ๋ฅผ ํด๊ฒฐํฉ๋๋ค. ๋ณ๊ฒฝ ์ฌํญ์ ๊ฐ์งํ๊ณ , ํค๋์ ํธํฐ์ ๊ฐ์ ๊ด๋ จ ์๋ ์น์ ์ ๋ฌด์ํ๋ฉฐ, ๊ฐ์กฐ ์คํ์ผ์ ์ฌ์ฉ์ ์ ์ํ๊ณ , ์ ๋ฌธ์ ์ธ ๋น๊ต ๋ณด๊ณ ์๋ฅผ ํ๋ก๊ทธ๋๋ฐ ๋ฐฉ์์ผ๋ก ์์ฑํ ์ ์์ต๋๋ค.
์ด ํฌ๊ด์ ์ธ ๊ฐ์ด๋์์๋ ์๋ ์์ ์๊ฐ์ ํฌ๊ฒ ์ ๊ฐํ๋ฉด์ ๋์น๋ ๋ถ๋ถ์ด ์๋๋ก ๋ณด์ฅํ๋ ๊ฒฌ๊ณ ํ Java ๋ฌธ์ ๋น๊ต API ์๋ฃจ์ ๊ตฌํ ๋ฐฉ๋ฒ์ ์์๋ด ๋๋ค. ๊ธฐ๋ณธ ์ค์ ๋ถํฐ ์ค์ ํ๋ก๋์ ํ๊ฒฝ์์ ์๋ํ๋ ๊ณ ๊ธ ์ปค์คํฐ๋ง์ด์ง ๊ธฐ์ ๊น์ง ๋ชจ๋ ๋ค๋ฃน๋๋ค.
- Can GroupDocs compare Excel files in Java? Yes, just load the
.xlsxfiles with theComparerclass. - How to ignore headers/footers? Set
setHeaderFootersComparison(false)inCompareOptions. - What about large PDFs? Increase JVM heap and enable memory optimization.
- Can I compare passwordโprotected PDFs? Provide the password when creating the
Comparer. - Is there a way to change highlight colors? Use
StyleSettingsfor inserted, deleted, and changed items.
java compare excel files๋ Java ์ฝ๋๋ฅผ ์ฌ์ฉํด ๋ ๊ฐ์ Excel ์ํฌ๋ถ ๊ฐ ์ฐจ์ด๋ฅผ ํ๋ก๊ทธ๋๋ฐ ๋ฐฉ์์ผ๋ก ๊ฐ์งํ๋ ๊ฒ์ ์๋ฏธํฉ๋๋ค. GroupDocs.Comparison API๋ ์คํ๋ ๋์ํธ ๋ด์ฉ์ ์ฝ๊ณ ์
์์ค์ ๋ณ๊ฒฝ์ ํ๊ฐํ์ฌ ์ถ๊ฐ, ์ญ์ , ์์ ๋ ๋ด์ฉ์ ๊ฐ์กฐํ๋ ์ฐจ์ด ๋ณด๊ณ ์๋ฅผ ์์ฑํฉ๋๋ค.
์๋ ๋ฌธ์ ๋น๊ต๋ ๋จ์ํ ๋ฒ๊ฑฐ๋ก์ด ๊ฒ์ด ์๋๋ผ ์ํํฉ๋๋ค. ์ฐ๊ตฌ์ ๋ฐ๋ฅด๋ฉด ์ฌ๋์ด ์๋์ผ๋ก ๋ฌธ์๋ฅผ ๋น๊ตํ ๋ ์ค์ํ ๋ณ๊ฒฝ ์ฌํญ์ ์ฝ 20โฏ%๋ฅผ ๋์น๋ค๊ณ ํฉ๋๋ค. ๊ฐ๋ฐ์๋ค์ด ํ๋ก๊ทธ๋๋ฐ ๋ฐฉ์ ์๋ฃจ์ ์ผ๋ก ์ ํํ๋ ์ด์ ๋ ๋ค์๊ณผ ๊ฐ์ต๋๋ค.
๊ณตํต ๋ฌธ์ ์ :
- ์๊ฐ ์๋ชจ: ์๋์ด ๊ฐ๋ฐ์๊ฐ ์ฃผ๋น 3โ4โฏ์๊ฐ์ ๋ฌธ์ ๊ฒํ ์ ์ฌ์ฉ
- ์ธ๊ฐ ์ค๋ฅ: ๋ฒ๋ฅ ๊ณ์ฝ์๋ ๊ธฐ์ ์ฌ์์์์ ์ค์ํ ๋ณ๊ฒฝ์ ๋์นจ
- ํ์คํ ๋ถ์กฑ: ํ์๋ง๋ค ๊ฐ์กฐ ๋ฐฉ์์ด ๋ฌ๋ผ ์ผ๊ด์ฑ ๊ฒฐ์ฌ
- ๊ท๋ชจ ๋ฌธ์ : ์๋ฐฑ ๊ฐ์ ๋ฌธ์๋ฅผ ์๋์ผ๋ก ๋น๊ตํ๋ ๊ฒ์ ๋ถ๊ฐ๋ฅ
API ์๋ฃจ์ ์ ๊ณต:
- 99.9โฏ% ์ ํ๋: ๋ฌธ์ ์์ค์ ๋ชจ๋ ๋ณ๊ฒฝ์ ์๋์ผ๋ก ํฌ์ฐฉ
- ์๋: 100โฏํ์ด์ง ์ด์์ ๋ฌธ์๋ฅผ 30โฏ์ด ์ด๋ด์ ๋น๊ต
- ์ผ๊ด์ฑ: ๋ชจ๋ ๋น๊ต์์ ํ์คํ๋ ๊ฐ์กฐ ๋ฐ ๋ณด๊ณ ์ ์ ๊ณต
- ํตํฉ: ๊ธฐ์กด Java ์ํฌํ๋ก์ CI/CD ํ์ดํ๋ผ์ธ์ ์ํํ ์ ์ฉ
์ด Java ๋ฌธ์ ๋น๊ต API๋ ๋ค์ ์ํฉ์์ ๋ฐ์ด๋ ์ฑ๋ฅ์ ๋ฐํํฉ๋๋ค.
- ๋ฒ๋ฅ ๋ฌธ์ ๊ฒํ โ ๊ณ์ฝ ๋ณ๊ฒฝ ๋ฐ ์์ ์ฌํญ์ ์๋์ผ๋ก ์ถ์
- ๊ธฐ์ ๋ฌธ์ โ API ๋ฌธ์ ์ ๋ฐ์ดํธ ๋ฐ ๋ณ๊ฒฝ ๋ก๊ทธ ๋ชจ๋ํฐ๋ง
- ์ฝํ ์ธ ๊ด๋ฆฌ โ ๋ธ๋ก๊ทธ ๊ฒ์๋ฌผ, ๋ง์ผํ ์๋ฃ, ์ฌ์ฉ์ ๋งค๋ด์ผ ๋น๊ต
- ๊ท์ ์ค์ ๊ฐ์ฌ โ ์ ์ฑ ๋ฌธ์๊ฐ ๊ท์ ์๊ตฌ์ฌํญ์ ์ถฉ์กฑํ๋์ง ํ์ธ
- ๋ฒ์ ๊ด๋ฆฌ โ Git๊ณผ ์ฐ๋ํด ์ธ๊ฐ์ด ์ฝ์ ์ ์๋ ๋ฌธ์ ์ฐจ์ด ์ ๊ณต
GroupDocs.Comparison for Java๋ ๊ธฐ๋ณธ์ ์ผ๋ก 50โฏ๊ฐ ์ด์์ ํ์ผ ํ์์ ์ง์ํฉ๋๋ค.
์ฃผ์ ํ์:
- ๋ฌธ์: Word (DOCX, DOC), PDF, RTF, ODT
- ์คํ๋ ๋์ํธ: Excel (XLSX, XLS), CSV, ODS
- ํ๋ ์ ํ ์ด์ : PowerPoint (PPTX, PPT), ODP
- ํ ์คํธ ํ์ผ: TXT, HTML, XML, MD
- ์ด๋ฏธ์ง: PNG, JPEG, BMP, GIF (์๊ฐ์ ๋น๊ต)
๊ณ ๊ธ ๊ธฐ๋ฅ:
- ๋น๋ฐ๋ฒํธ๋ก ๋ณดํธ๋ ๋ฌธ์ ๋น๊ต
- ๋ค๊ตญ์ด ํ ์คํธ ๊ฐ์ง ๋ฐ ๋น๊ต
- ๋ฌธ์ ์ ํ๋ณ ๋ง์ถค ๋ฏผ๊ฐ๋ ์ค์
- ๋ค์ค ๋ฌธ์ ์์ ๋ํ ๋ฐฐ์น ์ฒ๋ฆฌ
- ํด๋ผ์ฐ๋ ๋ฐ ์จํ๋ ๋ฏธ์ค ๋ฐฐํฌ ์ต์
์ฝ๋ ์์ฑ์ ์์ํ๊ธฐ ์ ์ ๋ค์ ์๊ตฌ ์ฌํญ์ ์ถฉ์กฑํ๋์ง ํ์ธํ์ธ์.
- Java Development Kit (JDK): ๋ฒ์ โฏ8 ์ด์ (JDKโฏ11+ ๊ถ์ฅ)
- ๋น๋ ๋๊ตฌ: Mavenโฏ3.6+ ๋๋ Gradleโฏ6.0+
- ๋ฉ๋ชจ๋ฆฌ: ๋์ฉ๋ ๋ฌธ์ ์ฒ๋ฆฌ๋ฅผ ์ํด ์ต์โฏ4โฏGB RAM
- ์คํ ๋ฆฌ์ง: ์์ ๋น๊ต ํ์ผ์ ์ํ 500โฏMB ์ด์์ ์ฌ์ ๊ณต๊ฐ
pom.xml์ GroupDocs ์ ์ฅ์์ ์์กด์ฑ์ ์ถ๊ฐํฉ๋๋ค. ์ด ์ค์ ์ ๊ณต์ ๋ฆด๋ฆฌ์ค ์ฑ๋์์ ๋ผ์ด๋ธ๋ฌ๋ฆฌ๋ฅผ ๊ฐ์ ธ์ค๋๋ก ๋ณด์ฅํฉ๋๋ค.
<repositories>
<repository>
<id>repository.groupdocs.com</id>
<name>GroupDocs Repository</name>
<url>https://releases.groupdocs.com/comparison/java/</url>
</repository>
</repositories>
<dependencies>
<dependency>
<groupId>com.groupdocs</groupId>
<artifactId>groupdocs-comparison</artifactId>
<version>25.2</version>
</dependency>
</dependencies>๊ฐ๋ฐ ๋ฐ ํ ์คํธ์ฉ:
- ๋ฌด๋ฃ ์ฒดํ: GroupDocs Downloads์์ ๋ค์ด๋ก๋ โ ์ํฐ๋งํฌ๊ฐ ํฌํจ๋ ์ถ๋ ฅ ์ ๊ณต
- ์์ ๋ผ์ด์ ์ค: GroupDocs Support๋ฅผ ํตํด 30์ผ ์ ์ฒด ์ก์ธ์ค ํ๋
ํ๋ก๋์ ์ฉ:
- ์ ์ ๋ผ์ด์ ์ค: ๋ฌด์ ํ ์์ ์ฌ์ฉ์ ์ํด GroupDocs Purchase์์ ๊ตฌ๋งค
๋ผ์ด์ ์ค ํ์ผ์ ํ๋ณดํ ํ ๋ค์๊ณผ ๊ฐ์ด ์ด๊ธฐํํฉ๋๋ค.
// License initialization - do this once at application startup
com.groupdocs.comparison.License license = new com.groupdocs.comparison.License();
license.setLicense("path/to/your/license/file.lic");ํ: ๋ผ์ด์ ์ค ํ์ผ์ ์ ํ๋ฆฌ์ผ์ด์
์ resources ํด๋์ ์ ์ฅํ๊ณ getClass().getResourceAsStream()์ ์ฌ์ฉํด ๋ก๋ํ๋ฉด ํ๊ฒฝ ๊ฐ ์ด์์ฑ์ด ํฅ์๋ฉ๋๋ค.
์ ์ค์ํ๊ฐ: ํค๋์ ํธํฐ์๋ ํ์์คํฌํ, ํ์ด์ง ๋ฒํธ, ์์ฑ์ ์ ๋ณด ๋ฑ ๋ฒ์ ๋ง๋ค ๋ฌ๋ผ์ง๋ ๋์ ๋ด์ฉ์ด ํฌํจ๋๋ ๊ฒฝ์ฐ๊ฐ ๋ง์ ์ค์ ๋ด์ฉ ๋น๊ต์๋ ๋ฌด๊ดํฉ๋๋ค. ์ด๋ฌํ ์น์ ์ ๋ฌด์ํ๋ฉด ์ก์์ด ์ค์ด๋ค๊ณ ์๋ฏธ ์๋ ๋ณ๊ฒฝ์ ์ง์คํ ์ ์์ต๋๋ค.
์ค์ ์๋๋ฆฌ์ค: ๊ณ์ฝ ๋ฒ์ ์ ๋น๊ตํ ๋ ๊ฐ ๊ฐ์ ๋ณธ์ ์๋ก ๋ค๋ฅธ ๋ ์ง๊ฐ ํธํฐ์ ๋ค์ด๊ฐ์ง๋ง, ๋ณธ๋ฌธ ์กฐํญ์ ๋ณ๊ฒฝ๋ง ํ์ธํ๊ณ ์ถ์ ๋.
import com.groupdocs.comparison.Comparer;
import com.groupdocs.comparison.options.CompareOptions;
import java.io.FileOutputStream;
public class IgnoreHeaderFooterExample {
public static void main(String[] args) throws Exception {
String outputFileName = "YOUR_OUTPUT_DIRECTORY/IgnoreHeaderFooter_result.docx";
try (OutputStream resultStream = new FileOutputStream(outputFileName);
Comparer comparer = new Comparer("YOUR_DOCUMENT_DIRECTORY/source_with_footer.docx")) {
comparer.add("YOUR_DOCUMENT_DIRECTORY/target_with_footer.docx");
// Set comparison options to ignore headers and footers
CompareOptions compareOptions = new CompareOptions.Builder()
.setHeaderFootersComparison(false)
.build();
final Path resultPath = comparer.compare(resultStream, new SaveOptions(), compareOptions);
}
}
}ํต์ฌ ์ด์ :
- ๊ฒฐ๊ณผ ์ ๋ฆฌ โ ํฌ๋งท ์ฐจ์ด๊ฐ ์๋ ์ค์ ๋ด์ฉ ๋ณ๊ฒฝ์ ์ง์ค
- ์คํ ๊ฐ์ โ ๊ด๋ จ ์๋ ๋ณ๊ฒฝ ์๋ฆผ์ ์ ๊ฑฐ
- ์ฑ๋ฅ ํฅ์ โ ๋ถํ์ํ ๋น๊ต ์์ ์ ๊ฑด๋๋ฐ์ด ์ฒ๋ฆฌ ์๋ ๊ฐ์
๋น์ฆ๋์ค ๋งฅ๋ฝ: ๋น๊ต ๋ณด๊ณ ์๋ฅผ ์ธ์ํ๊ฑฐ๋ PDF๋ก ๋ฐฐํฌํ ๋ ์ฉ์ง ํฌ๊ธฐ๋ฅผ ์ ์ดํ๋ฉด ๋ค์ํ ๋ทฐ์ด์ ์ธ์ ํ๊ฒฝ์์ ์ผ๊ด๋ ๋ ์ด์์์ ์ ์งํ ์ ์์ต๋๋ค.
์ฌ์ฉ ์ฌ๋ก: ๋ฒ๋ฌดํ์ด ๋ฒ์ ์ ์ถ์ฉ ๋๋ ๊ณ ๊ฐ ํ๋ ์ ํ ์ด์ ์ฉ์ผ๋ก ํน์ ํฌ๋งท์ ๋น๊ต ๋ณด๊ณ ์๋ฅผ ์๊ตฌํ๋ ๊ฒฝ์ฐ.
import com.groupdocs.comparison.Comparer;
import com.groupdocs.comparison.options.CompareOptions;
import com.groupdocs.comparison.options.enums.PaperSize;
public class SetOutputPaperSizeExample {
public static void main(String[] args) throws Exception {
String outputFileName = "YOUR_OUTPUT_DIRECTORY/SetOutputPaperSize_result.docx";
try (OutputStream resultStream = new FileOutputStream(outputFileName);
Comparer comparer = new Comparer("YOUR_DOCUMENT_DIRECTORY/source_word.docx")) {
comparer.add("YOUR_DOCUMENT_DIRECTORY/target1_word.docx");
// Set the paper size to A6
CompareOptions compareOptions = new CompareOptions.Builder()
.setPaperSize(PaperSize.A6)
.build();
final Path resultPath = comparer.compare(resultStream, compareOptions);
}
}
}์ง์ ์ฉ์ง ํฌ๊ธฐ: A0โA10, Letter, Legal, Tabloid ๋ฐ ์ฌ์ฉ์ ์ ์ ์น์. ๋ฐฐํฌ ์๊ตฌ์ ๋ฐ๋ผ ์ ํํ์ธ์โ์ ๋ฝ ๊ณ ๊ฐ์ A4, ๋ฏธ๊ตญ ๊ธฐ๋ฐ ํ์ Letter๋ฅผ ์ฃผ๋ก ์ฌ์ฉํฉ๋๋ค.
๋์ ๊ณผ์ : ๋ฌธ์ ์ ํ๋ง๋ค ํ์ํ ๋ณ๊ฒฝ ๊ฐ์ง ์์ค์ด ๋ค๋ฆ ๋๋ค. ๋ฒ๋ฅ ๊ณ์ฝ์๋ ๋ชจ๋ ์ผํ๊น์ง ๊ฐ์งํด์ผ ํ์ง๋ง, ๋ง์ผํ ์๋ฃ๋ ํฐ ๋ด์ฉ ๋ณ๊ฒฝ๋ง ์ ๊ฒฝ ์ฐ๋ฉด ๋ฉ๋๋ค.
๋ฏผ๊ฐ๋ ์๋ ๋ฐฉ์: 0โ100 ๋ฒ์์ ์ค์ผ์ผ์ด๋ฉฐ ๊ฐ์ด ๋์์๋ก ๋ ์ธ๋ฐํ ๋ณ๊ฒฝ์ ๊ฐ์งํฉ๋๋ค.
- 0โ25: ์ฃผ์ ๋ณ๊ฒฝ๋ง (๋จ๋ฝ ์ถ๊ฐ/์ญ์ )
- 26โ50: ์ค๊ฐ ์์ค ๋ณ๊ฒฝ (๋ฌธ์ฅ ์์ )
- 51โ75: ์์ธ ๋ณ๊ฒฝ (๋จ์ด ์์ค ์์ )
- 76โ100: ์์ฃผ ์ธ๋ฐํ ๋ณ๊ฒฝ (๋ฌธ์ ์์ค ์ฐจ์ด)
import com.groupdocs.comparison.Comparer;
import com.groupdocs.comparison.options.CompareOptions;
public class AdjustComparisonSensitivityExample {
public static void main(String[] args) throws Exception {
String outputFileName = "YOUR_OUTPUT_DIRECTORY/AdjustComparisonSensitivity_result.docx";
try (OutputStream resultStream = new FileOutputStream(outputFileName);
Comparer comparer = new Comparer("YOUR_DOCUMENT_DIRECTORY/source_word.docx")) {
comparer.add("YOUR_DOCUMENT_DIRECTORY/target1_word.docx");
// Set sensitivity to 100 for maximum detail
CompareOptions compareOptions = new CompareOptions.Builder()
.setSensitivityOfComparison(100)
.build();
final Path resultPath = comparer.compare(resultStream, compareOptions);
}
}
}๋ฏผ๊ฐ๋ ์ค์ ๋ชจ๋ฒ ์ฌ๋ก:
- ๋ฒ๋ฅ ๋ฌธ์: ํฌ๊ด์ ์ธ ๊ฐ์ง๋ฅผ ์ํด 90โ100 ์ฌ์ฉ
- ๋ง์ผํ ์ฝํ ์ธ : ์ค์ง์ ์ธ ์์ ์ ์ง์คํ๋ ค๋ฉด 40โ60 ์ฌ์ฉ
- ๊ธฐ์ ์ฌ์: ์ค์ํ ์ธ๋ถ ์ฌํญ์ ๋์น์ง ์์ผ๋ฉด์ ์ฌ์ํ ํฌ๋งท ์ฐจ์ด๋ ๊ฑธ๋ฌ๋ด๋ ค๋ฉด 70โ80 ์ฌ์ฉ
์ ๋ง์ถค ์คํ์ผ์ด ์ค์ํ๊ฐ: ๊ธฐ๋ณธ ๊ฐ์กฐ ์์์ด ํ์ ๊ฒํ ํ์ค์ด๋ ๊ธฐ์ ๋ธ๋๋ฉ๊ณผ ๋ง์ง ์์ ์ ์์ต๋๋ค. ๋ง์ถค ์คํ์ผ์ ์ ์ฉํ๋ฉด ๋ฌธ์ ๊ฐ๋ ์ฑ์ด ๋์์ง๊ณ ์ดํด๊ด๊ณ์๊ฐ ๋ค์ํ ๋ณ๊ฒฝ ์ ํ์ ๋น ๋ฅด๊ฒ ํ์ ํ ์ ์์ต๋๋ค.
์ ๋ฌธ ์ ๊ทผ๋ฒ: ์์ฑ ์ฌ๋ฆฌํ์ ํ์ฉํด ์ญ์ ๋ ๋นจ๊ฐ(๊ธด๊ธํจ), ์ถ๊ฐ๋ ์ด๋ก(๊ธ์ ์ ๋ณํ), ์์ ์ ํ๋(๊ฒํ ํ์)์ผ๋ก ์ง์ ํฉ๋๋ค.
import com.groupdocs.comparison.Comparer;
import com.groupdocs.comparison.options.CompareOptions;
import com.groupdocs.comparison.options.save.SaveOptions;
import com.groupdocs.comparison.options.style.StyleSettings;
import java.awt.Color;
import java.io.FileInputStream;
import java.io.FileOutputStream;
import java.io.InputStream;
import java.io.OutputStream;
public class CustomizeChangesStylesStreamExample {
public static void main(String[] args) throws Exception {
String outputFileName = "YOUR_OUTPUT_DIRECTORY/CustomizeChangesStylesStream_result.docx";
try (InputStream sourceFile = new FileInputStream("YOUR_DOCUMENT_DIRECTORY/source_word.docx");
InputStream targetFile = new FileInputStream("YOUR_DOCUMENT_DIRECTORY/target1_word.docx");
OutputStream resultStream = new FileOutputStream(outputFileName);
Comparer comparer = new Comparer(sourceFile)) {
comparer.add(targetFile);
// Customize change styles for professional appearance
StyleSettings insertedStyle = new StyleSettings();
insertedStyle.setHighlightColor(Color.GREEN); // Green for additions
StyleSettings deletedStyle = new StyleSettings();
deletedStyle.setHighlightColor(Color.RED); // Red for deletions
StyleSettings changedStyle = new StyleSettings();
changedStyle.setHighlightColor(Color.BLUE); // Blue for modifications
CompareOptions compareOptions = new CompareOptions.Builder()
.setInsertedItemStyle(insertedStyle)
.setDeletedItemStyle(deletedStyle)
.setChangedItemStyle(changedStyle)
.build();
final Path resultPath = comparer.compare(resultStream, compareOptions);
}
}
}๊ณ ๊ธ ์คํ์ผ ์ต์
(StyleSettings์์ ์ ๊ณต):
- ๊ธ๊ผด ๊ตต๊ธฐ, ํฌ๊ธฐ, ์ข ๋ฅ ์์
- ๋ฐฐ๊ฒฝ ์์ ๋ฐ ํฌ๋ช ๋ ์กฐ์
- ๋ณ๊ฒฝ ์ ํ๋ณ ํ ๋๋ฆฌ ์คํ์ผ ์ง์
- ์ญ์ ๋ ๋ด์ฉ์ ๋ํ ์ทจ์์ ์ต์
๋ฌธ์ : 50โฏMB ์ด์ ๋ฌธ์๋ฅผ ๋น๊ตํ ๋ OutOfMemoryError ๋ฐ์
ํด๊ฒฐ์ฑ
: JVM ํ ํฌ๊ธฐ๋ฅผ ๋๋ฆฌ๊ณ ์คํธ๋ฆฌ๋ฐ ๋ฐฉ์ ๊ตฌํ
# Increase heap size for large document processing
java -Xmx4g -XX:MaxMetaspaceSize=512m YourComparisonApp์ฝ๋ ์ต์ ํ:
// Use streaming for memory efficiency
try (Comparer comparer = new Comparer(sourceStream)) {
// Process in chunks for very large documents
CompareOptions options = new CompareOptions.Builder()
.setMemoryOptimization(true) // Enable memory optimization
.build();
}๋ฌธ์ : ์ ๊ธด ๋ฌธ์์์ ๋น๊ต๊ฐ ์คํจํจ
์๋ฐฉ ์ ๋ต:
// Check document accessibility before comparison
try {
Comparer comparer = new Comparer(sourceFile, "password123");
// Document loaded successfully, proceed with comparison
} catch (PasswordRequiredException ex) {
// Handle passwordโprotected documents
log.error("Document requires password: " + sourceFile);
} catch (CorruptedFileException ex) {
// Handle corrupted files gracefully
log.error("File corruption detected: " + sourceFile);
}๋์ ๊ณผ์ : 100๊ฐ ์ด์์ ๋ฌธ์ ์์ ํจ์จ์ ์ผ๋ก ์ฒ๋ฆฌ
ํด๊ฒฐ์ฑ
: ์ค๋ ๋ ํ์ ํ์ฉํ ๋ณ๋ ฌ ์ฒ๋ฆฌ ๊ตฌํ
ExecutorService executor = Executors.newFixedThreadPool(4);
List<Future<ComparisonResult>> futures = new ArrayList<>();
for (DocumentPair pair : documentPairs) {
futures.add(executor.submit(() -> compareDocuments(pair)));
}
// Wait for all comparisons to complete
for (Future<ComparisonResult> future : futures) {
ComparisonResult result = future.get();
// Process results
}
executor.shutdown();PDF ๋น๊ต ์ ๋์ ๊ณผ์ :
- ์ค์บ๋ PDF: ํ ์คํธ ์ถ์ถ์ ์ํด OCR ์ ์ฒ๋ฆฌ ํ์
- ๋ณต์กํ ๋ ์ด์์: ๋ฏผ๊ฐ๋ ์กฐ์ ์ ์๋์ผ๋ก ์ํํด์ผ ํ ์ ์์
- ๋ด์ฅ ํฐํธ: ํ๊ฒฝ ๊ฐ ์ผ๊ด๋ ํฐํธ ๋ ๋๋ง์ ์ํด ํฐํธ ๊ด๋ฆฌ ํ์
Word ๋ฌธ์ ์ด์:
- ๋ณ๊ฒฝ ๋ด์ฉ ์ถ์ : ๋น๊ต ์ ์ ๊ธฐ์กด ํธ๋ ์ฒด์ธ์ง ๋นํ์ฑํ
- ๋ด์ฅ ๊ฐ์ฒด: ์ ํํ ๋น๊ต๋์ง ์์ ์ ์์ผ๋ ๋ณ๋ ์ถ์ถ ํ ๋น๊ต
- ๋ฒ์ ํธํ์ฑ: ๋ค์ํ Word ํฌ๋งท ๋ฒ์ ์์ ํ ์คํธ ํ์
์ ๋ ฅ ์ ๋ฆฌ: ๋ฉํ๋ฐ์ดํฐ์ ๋ถํ์ํ ํฌ๋งท์ ์ ๊ฑฐํ๋ฉด ์ ํ๋์ ์๋๊ฐ ํฅ์๋ฉ๋๋ค.
// Example preprocessing workflow
public void preprocessDocument(String filePath) {
// Remove comments and tracked changes
// Standardize formatting
// Extract textโonly version for pure content comparison
}๊ตฌ์ฑ ํ๋กํ์ผ:
public class ComparisonProfiles {
public static CompareOptions getLegalDocumentProfile() {
return new CompareOptions.Builder()
.setSensitivityOfComparison(95)
.setHeaderFootersComparison(false)
.setShowRevisions(true)
.build();
}
public static CompareOptions getMarketingContentProfile() {
return new CompareOptions.Builder()
.setSensitivityOfComparison(45)
.setIgnoreFormatting(true)
.setFocusOnContent(true)
.build();
}
}๊ฒฌ๊ณ ํ ์ค๋ฅ ๊ด๋ฆฌ:
public ComparisonResult safeCompareDocuments(String source, String target) {
try {
return performComparison(source, target);
} catch (Exception ex) {
logger.error("Comparison failed for {} vs {}: {}", source, target, ex.getMessage());
return ComparisonResult.failure(ex.getMessage());
}
}์ค๋งํธ ์บ์ฑ ๊ตฌํ:
- ๋์ผ ํ์ผ ์์ ๋ํ ๋น๊ต ๊ฒฐ๊ณผ๋ฅผ ์บ์
- ๋ณ๊ฒฝ๋์ง ์์ ํ์ผ์ ์๋ณํ๊ธฐ ์ํด ๋ฌธ์ ์ง๋ฌธ ์ ์ฅ
- ๋นํต์ฌ ๋น๊ต๋ ๋น๋๊ธฐ ์ฒ๋ฆฌ๋ก ์ ํ
@Service
public class ContractReviewService {
public void processContractRevision(String originalContract, String revisedContract) {
CompareOptions legalOptions = ComparisonProfiles.getLegalDocumentProfile();
try (Comparer comparer = new Comparer(originalContract)) {
comparer.add(revisedContract);
Path result = comparer.compare(generateOutputPath(), legalOptions);
// Send comparison report to legal team
emailService.sendComparisonReport(result, legalTeamEmails);
// Log changes for audit trail
auditService.logDocumentChanges(extractChanges(result));
}
}
}@RestController
public class DocumentComparisonController {
@PostMapping("/api/documents/compare")
public ResponseEntity<ComparisonReport> compareDocuments(
@RequestParam("source") MultipartFile source,
@RequestParam("target") MultipartFile target,
@RequestParam(value = "sensitivity", defaultValue = "75") int sensitivity) {
CompareOptions options = new CompareOptions.Builder()
.setSensitivityOfComparison(sensitivity)
.build();
ComparisonReport report = documentComparisonService.compare(source, target, options);
return ResponseEntity.ok(report);
}
}Q: GroupDocs for Java์์ ๋น๊ต ์ ํค๋์ ํธํฐ๋ฅผ ๋ฌด์ํ ์ ์๋์?
A: ์, CompareOptions์์ setHeaderFootersComparison(false)๋ฅผ ์ฌ์ฉํ๋ฉด ๋ฉ๋๋ค. ํค๋์ ํ์์คํฌํ์ ๊ฐ์ด ํต์ฌ ๋ณ๊ฒฝ๊ณผ ๋ฌด๊ดํ ๋์ ๋ด์ฉ์ด ํฌํจ๋ ๊ฒฝ์ฐ์ ์ ์ฉํฉ๋๋ค.
Q: Java์์ GroupDocs๋ฅผ ์ฌ์ฉํด ์ถ๋ ฅ ์ฉ์ง ํฌ๊ธฐ๋ฅผ ์ค์ ํ๋ ค๋ฉด ์ด๋ป๊ฒ ํด์ผ ํ๋์?
A: CompareOptions์ setPaperSize(PaperSize.A6)์ ๊ฐ์ ์์๋ฅผ ์ ์ฉํฉ๋๋ค. ์ด๋ ๊ฒ ํ๋ฉด ์ธ์์ฉ ๋ณด๊ณ ์๋ฅผ ๋ง๋ค ์ ์์ต๋๋ค. ์ง์๋๋ ํฌ๊ธฐ์๋ A0โA10, Letter, Legal, Tabloid ๋ฑ์ด ํฌํจ๋ฉ๋๋ค.
Q: ๋ฌธ์ ์ ํ๋ณ๋ก ๋น๊ต ๋ฏผ๊ฐ๋๋ฅผ ์ธ๋ฐํ๊ฒ ์กฐ์ ํ ์ ์๋์?
A: ๋ฌผ๋ก ์
๋๋ค. setSensitivityOfComparison()์ 0โ100 ์ฌ์ด ๊ฐ์ ์ง์ ํ๋ฉด ๋ฉ๋๋ค. ๋์ ๊ฐ์ ๋ ์ธ๋ฐํ ๋ณ๊ฒฝ์ ๊ฐ์งํ๋ฏ๋ก ๋ฒ๋ฅ ๋ฌธ์์ ์ ํฉํ๊ณ , ๋ฎ์ ๊ฐ์ ๋ง์ผํ
์ฝํ
์ธ ์ ์ ํฉํฉ๋๋ค.
Q: ์ฝ์
, ์ญ์ , ์์ ๋ ํ
์คํธ์ ์คํ์ผ์ ์ปค์คํฐ๋ง์ด์งํ ์ ์๋์?
A: ๊ฐ๋ฅํฉ๋๋ค. ๊ฐ ๋ณ๊ฒฝ ์ ํ์ ๋ํด ์ฌ์ฉ์ ์ ์ StyleSettings๋ฅผ ๋ง๋ ๋ค CompareOptions์ ์ ์ฉํ๋ฉด ๋ฉ๋๋ค. ๊ฐ์กฐ ์์, ๊ธ๊ผด, ํ
๋๋ฆฌ ๋ฑ์ ๋ธ๋๋์ ๋ง๊ฒ ์กฐ์ ํ ์ ์์ต๋๋ค.
Q: GroupDocs Comparison์ Java์์ ์์ํ๋ ค๋ฉด ์ด๋ค ์ ์ ์กฐ๊ฑด์ด ํ์ํ๊ฐ์?
A: JDKโฏ8 ์ด์ (JDKโฏ11+ ๊ถ์ฅ), Mavenโฏ3.6+ ๋๋ Gradleโฏ6.0+, ๋์ฉ๋ ๋ฌธ์ ์ฒ๋ฆฌ๋ฅผ ์ํ ์ต์ 4โฏGB RAM, ๊ทธ๋ฆฌ๊ณ GroupDocs ๋ผ์ด์ ์ค(๋ฌด๋ฃ ์ฒดํ ๊ฐ๋ฅ)๊ฐ ํ์ํฉ๋๋ค. ์ ์ฅ์์ ์์กด์ฑ์ ํ๋ก์ ํธ์ ์ถ๊ฐํ ๋ค ์์ ์ ๋ผ์ด์ ์ค๋ฅผ ์ด๊ธฐํํ๋ฉด ๋ฉ๋๋ค.
Q: GroupDocs.Comparison์์ ๋น๋ฐ๋ฒํธ๋ก ๋ณดํธ๋ ๋ฌธ์๋ฅผ ์ด๋ป๊ฒ ์ฒ๋ฆฌํ๋์?
A: Comparer๋ฅผ ์์ฑํ ๋ ๋ ๋ฒ์งธ ์ธ์๋ก ๋น๋ฐ๋ฒํธ๋ฅผ ์ ๋ฌํฉ๋๋ค: new Comparer(sourceFile, "password123"). PasswordRequiredException์ ์ ์ ํ ์ฒ๋ฆฌํ๋๋ก tryโcatch ๋ธ๋ก์ผ๋ก ๊ฐ์ธ์ธ์.
Q: GroupDocs.Comparison for Java๊ฐ ์ง์ํ๋ ํ์ผ ํ์์ ๋ฌด์์ธ๊ฐ์?
A: Word (DOCX, DOC), PDF, Excel (XLSX, XLS), PowerPoint (PPTX, PPT), ํ
์คํธ ํ์ผ (TXT, HTML, XML) ๋ฐ ์๊ฐ์ ๋น๊ต๋ฅผ ์ํ ์ด๋ฏธ์ง (PNG, JPEG) ๋ฑ 50๊ฐ ์ด์์ ํ์์ ์ง์ํฉ๋๋ค. API๊ฐ ์๋์ผ๋ก ํ์์ ๊ฐ์งํ์ง๋ง, ๋ฐฐ์น ์ฑ๋ฅ์ ๋์ด๊ธฐ ์ํด ํ์์ ๋ช
์์ ์ผ๋ก ์ง์ ํ ์๋ ์์ต๋๋ค.
Last Updated: 2025-12-31
Tested With: GroupDocs.Comparison 25.2 for Java
Author: GroupDocs