Skip to content

Commit 97792eb

Browse files
Committed the syncfusion java files
1 parent 1dc0753 commit 97792eb

File tree

2 files changed

+58
-7
lines changed

2 files changed

+58
-7
lines changed

demo/pom.xml

Lines changed: 30 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,22 +29,50 @@
2929
<properties>
3030
<java.version>17</java.version>
3131
</properties>
32+
<repositories>
33+
<repository>
34+
<id>Syncfusion-Java</id>
35+
<name>Syncfusion Java repo</name>
36+
<url>https://jars.syncfusion.com/repository/maven-public/</url>
37+
</repository>
38+
</repositories>
3239
<dependencies>
3340
<dependency>
3441
<groupId>org.springframework.boot</groupId>
3542
<artifactId>spring-boot-starter-web</artifactId>
3643
</dependency>
3744

3845
<dependency>
39-
<groupId>org.projectlombok</groupId>
40-
<artifactId>lombok</artifactId>
46+
<groupId>org.springframework.boot</groupId>
47+
<artifactId>spring-boot-devtools</artifactId>
48+
<scope>runtime</scope>
4149
<optional>true</optional>
4250
</dependency>
4351
<dependency>
4452
<groupId>org.springframework.boot</groupId>
4553
<artifactId>spring-boot-starter-test</artifactId>
4654
<scope>test</scope>
4755
</dependency>
56+
<dependency>
57+
<groupId>com.syncfusion</groupId>
58+
<artifactId>syncfusion-docio</artifactId>
59+
<version>27.1.58</version>
60+
</dependency>
61+
<dependency>
62+
<groupId>com.syncfusion</groupId>
63+
<artifactId>syncfusion-javahelper</artifactId>
64+
<version>27.1.58</version>
65+
</dependency>
66+
<dependency>
67+
<groupId>com.syncfusion</groupId>
68+
<artifactId>syncfusion-licensing</artifactId>
69+
<version>27.1.58</version>
70+
</dependency>
71+
<dependency>
72+
<groupId>com.syncfusion</groupId>
73+
<artifactId>syncfusion-ej2-wordprocessor</artifactId>
74+
<version>27.1.58</version>
75+
</dependency>
4876
</dependencies>
4977

5078
<build>

demo/src/main/java/com/example/demo/DemoApplication.java

Lines changed: 28 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -4,17 +4,40 @@
44
import org.springframework.boot.SpringApplication;
55
import org.springframework.boot.autoconfigure.SpringBootApplication;
66

7+
import java.io.ByteArrayOutputStream;
8+
import java.nio.charset.StandardCharsets;
9+
import com.syncfusion.licensing.SyncfusionLicenseProvider;
10+
import com.syncfusion.docio.*;
11+
712
@SpringBootApplication
813
public class DemoApplication {
914

1015
@Value("${app.key}")
1116
private static String licKey;
1217

13-
public static void main(String[] args) {
14-
licKey = "1234567989";
15-
System.out.println("License Key: " + licKey);
16-
System.out.println("Syncfusion");
18+
public static void main(String[] args) throws Exception {
19+
20+
SyncfusionLicenseProvider.registerLicense("GTIlMmhhZH1ifWdraGBifGJhfGpqampzYWBpZmppZmpoJTY9ODoTMTwrNTo/Nn06PQ==");
21+
22+
try (//Creates an instance of WordDocument Instance (Empty Word Document).
23+
WordDocument document = new WordDocument()) {
24+
document.ensureMinimal();
25+
//Append text to the last paragraph of the document.
26+
document.getLastParagraph().appendText("Hello World");
27+
ByteArrayOutputStream byteArrayOutputStream = new ByteArrayOutputStream();
28+
document.save(byteArrayOutputStream, FormatType.Txt);
29+
// Read text from ByteArrayOutputStream
30+
String textFromStream = readTextFromStream(byteArrayOutputStream);
31+
// Print the extracted text
32+
System.out.println("Text read from ByteArrayOutputStream:");
33+
System.out.println(textFromStream);
34+
}
35+
System.out.print("Completed");
1736
SpringApplication.run(DemoApplication.class, args);
1837
}
19-
38+
//Helper method to read text from ByteArrayOutputStream
39+
private static String readTextFromStream(ByteArrayOutputStream byteArrayOutputStream) {
40+
// Convert the byte array to a String
41+
return new String(byteArrayOutputStream.toByteArray(), StandardCharsets.UTF_8);
42+
}
2043
}

0 commit comments

Comments
 (0)