alaahong commented on code in PR #745:
URL: https://github.com/apache/fesod/pull/745#discussion_r2644654599


##########
fesod-sheet/src/test/java/org/apache/fesod/sheet/ods/OdsReadWriteTest.java:
##########
@@ -0,0 +1,194 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.apache.fesod.sheet.ods;
+
+import static org.junit.jupiter.api.Assertions.assertEquals;
+import static org.junit.jupiter.api.Assertions.assertNotNull;
+import static org.junit.jupiter.api.Assertions.assertTrue;
+import java.io.File;
+import java.util.ArrayList;
+import java.util.Date;
+import java.util.List;
+import lombok.EqualsAndHashCode;
+import lombok.Getter;
+import lombok.Setter;
+import org.apache.fesod.sheet.FesodSheet;
+import org.apache.fesod.sheet.annotation.ExcelProperty;
+import org.apache.fesod.sheet.context.AnalysisContext;
+import org.apache.fesod.sheet.read.listener.ReadListener;
+import org.apache.fesod.sheet.support.ExcelTypeEnum;
+import org.apache.fesod.sheet.util.FileUtils;
+import org.junit.jupiter.api.AfterEach;
+import org.junit.jupiter.api.BeforeEach;
+import org.junit.jupiter.api.Test;
+
+/**
+ * Test class for ODS (OpenDocument Spreadsheet) read and write functionality.
+ */
+public class OdsReadWriteTest {

Review Comment:
   do we have the possible to add some unit tests than current sample? as this 
pr involved many new classes~



##########
pom.xml:
##########
@@ -60,6 +60,7 @@
         <commons-collections4.version>4.4</commons-collections4.version>
         <commons-csv.version>1.11.0</commons-csv.version>
         <commons-lang3.version>3.16.0</commons-lang3.version>
+        <odfdom.version>0.9.0</odfdom.version>

Review Comment:
   just aware this is the latest version based on JDK 8 and it published at 
2021... so any alternative solution?



##########
fesod-sheet/src/main/java/org/apache/fesod/sheet/util/WorkBookUtil.java:
##########
@@ -106,6 +107,14 @@ public static void createWorkBook(WriteWorkbookHolder 
writeWorkbookHolder) throw
                 writeWorkbookHolder.setCachedWorkbook(csvWorkbook);
                 writeWorkbookHolder.setWorkbook(csvWorkbook);
                 return;
+            case ODS:
+                OdsWorkbook odsWorkbook = new OdsWorkbook(
+                        
writeWorkbookHolder.getGlobalConfiguration().getLocale(),
+                        
writeWorkbookHolder.getGlobalConfiguration().getUse1904windowing(),

Review Comment:
   does ODS support 1904 date system ?



##########
fesod-sheet/src/main/java/org/apache/fesod/sheet/support/ExcelTypeEnum.java:
##########
@@ -50,7 +50,12 @@ public enum ExcelTypeEnum {
     /**
      * xlsx
      */
-    XLSX(".xlsx", new byte[] {80, 75, 3, 4});
+    XLSX(".xlsx", new byte[] {80, 75, 3, 4}),
+
+    /**
+     * ods (OpenDocument Spreadsheet)
+     */
+    ODS(".ods", new byte[] {80, 75, 3, 4});

Review Comment:
   as ODS has same magic number with XLSX, so any potential issue during the 
magic usage in project level?



##########
website/docs/sheet/read/ods.md:
##########
@@ -0,0 +1,161 @@
+---
+id: 'ods'
+title: 'ODS'
+---
+
+# ODS File Format Support
+
+This chapter introduces how to read and write ODS (OpenDocument Spreadsheet) 
files using Fesod.
+
+## Overview
+
+ODS (OpenDocument Spreadsheet) is an open standard spreadsheet file format 
defined by OASIS. It is widely used in:
+
+- LibreOffice Calc
+- Apache OpenOffice Calc
+- Google Sheets (export format)
+- Many other open-source office suites
+
+Fesod provides full support for reading and writing ODS files using the same 
API as other formats (XLSX, XLS, CSV).
+
+## Reading ODS Files
+
+### Basic Reading
+
+Reading ODS files follows the same pattern as reading other spreadsheet 
formats:
+
+```java
+@Test
+public void readOds() {
+    String fileName = "path/to/demo.ods";
+
+    FesodSheet.read(fileName, DemoData.class, new DemoDataListener())
+            .sheet()
+            .doRead();
+}
+```
+
+### Explicit Type Specification
+
+When reading from an InputStream without a file extension, you can explicitly 
specify the file type:
+
+```java
+@Test
+public void readOdsFromStream() {
+    InputStream inputStream = getOdsInputStream();
+
+    FesodSheet.read(inputStream, DemoData.class, new DemoDataListener())
+            .excelType(ExcelTypeEnum.ODS)
+            .sheet()
+            .doRead();
+}
+```
+
+### Multiple Sheets
+
+ODS files support multiple sheets, and you can read them the same way as other 
formats:
+
+```java
+@Test
+public void readMultipleSheets() {
+    String fileName = "path/to/demo.ods";
+
+    // Read all sheets
+    FesodSheet.read(fileName, DemoData.class, new DemoDataListener())
+            .doReadAll();
+
+    // Or read specific sheets by index
+    FesodSheet.read(fileName, DemoData.class, new DemoDataListener())
+            .sheet(0)  // First sheet
+            .doRead();
+}
+```
+
+## Writing ODS Files
+
+### Basic Writing
+
+Writing ODS files is straightforward:
+
+```java
+@Test
+public void writeOds() {
+    String fileName = "path/to/output.ods";
+    List<DemoData> dataList = generateData();
+
+    FesodSheet.write(fileName, DemoData.class)
+            .sheet("Sheet1")
+            .doWrite(dataList);
+}
+```
+
+### Explicit Type Specification
+
+You can explicitly specify the output type:
+
+```java
+@Test
+public void writeOdsExplicit() {
+    String fileName = "path/to/output.ods";
+    List<DemoData> dataList = generateData();
+
+    FesodSheet.write(fileName, DemoData.class)
+            .excelType(ExcelTypeEnum.ODS)
+            .sheet("MySheet")
+            .doWrite(dataList);
+}
+```
+
+### Writing to OutputStream
+
+When writing to an OutputStream, explicitly specify the file type:
+
+```java
+@Test
+public void writeOdsToStream() throws IOException {
+    OutputStream outputStream = new FileOutputStream("output.ods");
+    List<DemoData> dataList = generateData();
+
+    FesodSheet.write(outputStream, DemoData.class)
+            .excelType(ExcelTypeEnum.ODS)
+            .sheet("Sheet1")
+            .doWrite(dataList);
+}
+```
+
+## Supported Features
+
+| Feature | Support Status |
+|---------|---------------|
+| Basic Read/Write | ✅ Full Support |
+| Multiple Sheets | ✅ Full Support |
+| String Data | ✅ Full Support |
+| Numeric Data | ✅ Full Support |
+| Date/Time Data | ✅ Full Support |
+| Boolean Data | ✅ Full Support |
+| Formulas | ⚠️ Basic Support |
+| Styles | ⚠️ Basic Support |
+| Images | ⚠️ Limited Support |
+| Comments | ⚠️ Limited Support |

Review Comment:
   Can you also provide the sample for above limited/basic support?  (optional 
as this is the first commit on this)



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to