Skip to content

Commit ded49ce

Browse files
committed
EDITORJAVA-1042 - Updated GroupDocs.Editor up to 23.9 version.
1 parent 409fa07 commit ded49ce

12 files changed

Lines changed: 36 additions & 28 deletions

File tree

Examples/Resources/sample.docx

12 KB
Binary file not shown.

Examples/Resources/sample.pptx

39.5 KB
Binary file not shown.

Examples/Resources/sample.xlsx

10.9 KB
Binary file not shown.

Examples/pom.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
<dependency>
1414
<groupId>com.groupdocs</groupId>
1515
<artifactId>groupdocs-editor</artifactId>
16-
<version>23.5</version>
16+
<version>23.9</version>
1717
</dependency>
1818
<dependency>
1919
<groupId>commons-io</groupId>

Examples/src/main/java/com/groupdocs/editor/examples/Constants.java

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,9 @@ public class Constants {
1919
public static final String SamplesPath = "\\Resources\\";
2020
public static final String OutputPath = "\\Output\\";
2121

22-
public static String SAMPLE_DOCX = getSampleFilePath("SampleDoc1.docx");
22+
public static String SAMPLE_DOCX = getSampleFilePath("sample.docx");
23+
24+
public static String SAMPLE_DOCX2 = getSampleFilePath("SampleDoc1.docx");
2325

2426
public static String SAMPLE_HTML = getSampleFilePath("SampleDoc1.html");
2527

@@ -31,13 +33,13 @@ public class Constants {
3133

3234
public static String SAMPLE_XLSX = getSampleFilePath("Sample_2SpreadSheet.xlsx");
3335

34-
public static String SAMPLE_XLS_PROTECTED = getSampleFilePath("Timesheet - excel_password.xls");
36+
public static String SAMPLE_XLS_PROTECTED = getSampleFilePath("sample.xlsx");
3537

3638
public static String SAMPLE_XML = getSampleFilePath("SampleXmlCorrect.xml");
3739

3840
public static String SAMPLE_TXT = getSampleFilePath("SamplePlainText1.txt");
3941

40-
public static String SAMPLE_PPTX = getSampleFilePath("ComplexTest.pptx");
42+
public static String SAMPLE_PPTX = getSampleFilePath("sample.pptx");
4143

4244
public static String SAMPLE_MSG = getSampleFilePath("ComplexExample.msg");
4345

Examples/src/main/java/com/groupdocs/editor/examples/advancedusage/WorkingWithPresentations.java

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
*/
66
package com.groupdocs.editor.examples.advancedusage;
77

8+
import java.io.*;
89
import java.util.List;
910
import com.groupdocs.editor.EditableDocument;
1011
import com.groupdocs.editor.Editor;
@@ -14,10 +15,6 @@
1415
import com.groupdocs.editor.options.PresentationEditOptions;
1516
import com.groupdocs.editor.options.PresentationLoadOptions;
1617
import com.groupdocs.editor.options.PresentationSaveOptions;
17-
import java.io.ByteArrayOutputStream;
18-
import java.io.FileInputStream;
19-
import java.io.InputStream;
20-
import java.io.OutputStream;
2118

2219
/**
2320
*
@@ -73,15 +70,19 @@ public static void run() throws Exception {
7370

7471
//11. Save it
7572
//11.1. Prepare saving filename and path
76-
String outputPath = Constants.getOutputFilePath(inputFilePath, saveOptions.getOutputFormat().getExtension());
73+
String outputPath = Constants.getOutputFilePath("sample_out", saveOptions.getOutputFormat().getExtension());
7774

7875
//11.2. Prepare stream for saving
79-
OutputStream outputStream = new ByteArrayOutputStream();
76+
ByteArrayOutputStream outputStream = new ByteArrayOutputStream();
8077
//FileStream outputStream = File.create(outputPath)
8178

8279
//11.3. Save
8380
editor.save(afterEdit, outputStream, saveOptions);
8481

82+
try(OutputStream outputFile = new FileOutputStream(outputPath)) {
83+
outputStream.writeTo(outputFile);
84+
}
85+
8586
System.out.println("WorkingWithPresentations routine has successfully finished");
8687
}
8788
}

Examples/src/main/java/com/groupdocs/editor/examples/advancedusage/WorkingWithSpreadsheetMultiTab.java

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -13,10 +13,8 @@
1313
import com.groupdocs.editor.options.SpreadsheetEditOptions;
1414
import com.groupdocs.editor.options.SpreadsheetLoadOptions;
1515
import com.groupdocs.editor.options.SpreadsheetSaveOptions;
16-
import java.io.ByteArrayOutputStream;
17-
import java.io.FileInputStream;
18-
import java.io.InputStream;
19-
import java.io.OutputStream;
16+
17+
import java.io.*;
2018

2119
/**
2220
*
@@ -57,11 +55,15 @@ public static void run() throws Exception {
5755
SpreadsheetSaveOptions saveOptions2 = new SpreadsheetSaveOptions(SpreadsheetFormats.Xlsb);
5856
String outputPath2 = Constants.getOutputFilePath(Constants.removeExtension(Path.getFileName(inputFilePath)) + "_tab2", "xlsb");
5957

60-
OutputStream outputStream1 = new ByteArrayOutputStream();
58+
ByteArrayOutputStream outputStream1 = new ByteArrayOutputStream();
6159
//FileStream outputStream1 = File.create(outputPath)
6260

6361
editor.save(secondTabBeforeEdit, outputPath2, saveOptions2);
6462

63+
try(OutputStream outputFile = new FileOutputStream(outputPath2)) {
64+
outputStream1.writeTo(outputFile);
65+
}
66+
6567
//7. Dispose both EditableDocument instances
6668
firstTabBeforeEdit.dispose();
6769
secondTabBeforeEdit.dispose();

Examples/src/main/java/com/groupdocs/editor/examples/advancedusage/WorkingWithWordProcessing.java

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
*/
66
package com.groupdocs.editor.examples.advancedusage;
77

8+
import java.io.*;
89
import java.util.List;
910
import com.groupdocs.editor.EditableDocument;
1011
import com.groupdocs.editor.Editor;
@@ -18,10 +19,7 @@
1819
import com.groupdocs.editor.options.WordProcessingProtection;
1920
import com.groupdocs.editor.options.WordProcessingProtectionType;
2021
import com.groupdocs.editor.options.WordProcessingSaveOptions;
21-
import java.io.ByteArrayOutputStream;
22-
import java.io.FileInputStream;
23-
import java.io.InputStream;
24-
import java.io.OutputStream;
22+
2523
import java.util.Locale;
2624

2725
/**
@@ -93,11 +91,15 @@ public static void run() throws Exception {
9391
String outputPath = Constants.getOutputFilePath(Constants.removeExtension(Path.getFileName(inputFilePath)), docmFormat.getExtension());
9492

9593
//11.2. Prepare stream for saving
96-
OutputStream outputStream = new ByteArrayOutputStream();
94+
ByteArrayOutputStream outputStream = new ByteArrayOutputStream();
9795
//FileStream outputStream1 = File.create(outputPath)
9896

9997
//11.3. Save
10098
editor.save(afterEdit, outputStream, saveOptions);
99+
100+
try(OutputStream outputFile = new FileOutputStream(outputPath)) {
101+
outputStream.writeTo(outputFile);
102+
}
101103
System.out.println("WorkingWithWordProcessing routine has successfully finished");
102104
}
103105
}

Examples/src/main/java/com/groupdocs/editor/examples/advancedusage/WorkingWithXml.java

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@
1717
import com.groupdocs.editor.htmlcss.css.properties.FontSize;
1818
import com.groupdocs.editor.htmlcss.css.properties.FontStyle;
1919
import com.groupdocs.editor.htmlcss.css.properties.FontWeight;
20+
import com.groupdocs.editor.htmlcss.css.properties.TextDecorationLineType;
2021
import com.groupdocs.editor.htmlcss.resources.IHtmlResource;
2122
import com.groupdocs.editor.htmlcss.serialization.QuoteType;
2223
import com.groupdocs.editor.internal.c.a.ms.System.IO.Path;
@@ -136,15 +137,15 @@ public static void highlightOptionsDemo()
136137

137138
//Setting attribute names font settings
138139
highlightOptions.getAttributeNamesFontSettings().setName("Arial");
139-
highlightOptions.getAttributeNamesFontSettings().setLine(WebFont.TextDecorationLine.Underline);
140+
highlightOptions.getAttributeNamesFontSettings().setLine(TextDecorationLineType.Underline);
140141
highlightOptions.getAttributeNamesFontSettings().setWeight(FontWeight.Lighter);
141142

142143
//Setting attribute values font settings
143-
highlightOptions.getAttributeValuesFontSettings().setLine((byte) (WebFont.TextDecorationLine.Underline + WebFont.TextDecorationLine.Overline));
144+
highlightOptions.getAttributeValuesFontSettings().setLine(TextDecorationLineType.op_Addition(TextDecorationLineType.Underline,TextDecorationLineType.Overline));
144145
highlightOptions.getAttributeValuesFontSettings().setStyle(FontStyle.Italic);
145146

146147
//Setting CDATA sections font settings
147-
highlightOptions.getCDataFontSettings().setLine(WebFont.TextDecorationLine.LineThrough);
148+
highlightOptions.getCDataFontSettings().setLine(TextDecorationLineType.LineThrough);
148149
highlightOptions.getCDataFontSettings().setSize(FontSize.Smaller);
149150

150151
//Setting HTML comments font settings
@@ -202,15 +203,15 @@ public static void complexEditDemo()
202203
editOptions1.setFixIncorrectStructure(true);
203204
editOptions1.setAttributeValuesQuoteType(QuoteType.SingleQuote);
204205
editOptions1.getFormatOptions().setLeftIndent(Length.parse("20px"));
205-
editOptions1.getHighlightOptions().getXmlTagsFontSettings().setLine((byte) (WebFont.TextDecorationLine.Underline + WebFont.TextDecorationLine.Overline));
206+
editOptions1.getHighlightOptions().getXmlTagsFontSettings().setLine(TextDecorationLineType.op_Addition(TextDecorationLineType.Underline,TextDecorationLineType.Overline));
206207
editOptions1.getHighlightOptions().getXmlTagsFontSettings().setWeight(FontWeight.Bold);
207208

208209
XmlEditOptions editOptions2 = new XmlEditOptions();
209210
editOptions2.setTrimTrailingWhitespaces(true);
210211
editOptions2.setAttributeValuesQuoteType(QuoteType.DoubleQuote);
211212
editOptions2.getFormatOptions().setLeafTextNodesOnNewline(true);
212213
editOptions2.getHighlightOptions().getXmlTagsFontSettings().setSize(FontSize.XLarge);
213-
editOptions2.getHighlightOptions().getHtmlCommentsFontSettings().setLine(WebFont.TextDecorationLine.LineThrough);
214+
editOptions2.getHighlightOptions().getHtmlCommentsFontSettings().setLine(TextDecorationLineType.LineThrough);
214215

215216
Editor editor = new Editor(xmlInputPath);
216217
try /*JAVA: was using*/

Examples/src/main/java/com/groupdocs/editor/examples/advancedusage/editabledocumentexamples/EditableDocumentAdvancedUsage.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,7 @@ public static void run() throws Exception {
6969

7070
//3.2. Generating prefixed HTML markup to a String.
7171
// Now, for example, <img src="car.jpg" /> is turned into <img src="http://example.com/ImagesHandler/id=car.jpg" />
72-
String prefixedHtmlMarkup = beforeEdit.getContent(customImagesRequesthandlerUri, customCssRequesthandlerUri);
72+
String prefixedHtmlMarkup = beforeEdit.getContentString(customImagesRequesthandlerUri, customCssRequesthandlerUri);
7373

7474
//3.3. Some WYSIWYG-editors can handle only pure TML markup, without header (in other words, only internals of HTML->BODY element).
7575
// EditableDocument can provide such part of a document.

0 commit comments

Comments
 (0)