Bingz2 commented on code in PR #2585:
URL: 
https://github.com/apache/incubator-seatunnel/pull/2585#discussion_r961240466


##########
seatunnel-connectors-v2/connector-file/connector-file-base/src/main/java/org/apache/seatunnel/connectors/seatunnel/file/sink/util/ExcelGenerator.java:
##########
@@ -0,0 +1,134 @@
+/*
+ * 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.seatunnel.connectors.seatunnel.file.sink.util;
+
+import org.apache.seatunnel.api.table.type.BasicType;
+import org.apache.seatunnel.api.table.type.SeaTunnelDataType;
+import org.apache.seatunnel.api.table.type.SeaTunnelRow;
+import org.apache.seatunnel.api.table.type.SeaTunnelRowType;
+import org.apache.seatunnel.api.table.type.SqlType;
+import org.apache.seatunnel.common.utils.JsonUtils;
+
+import org.apache.poi.ss.usermodel.Cell;
+import org.apache.poi.ss.usermodel.CellStyle;
+import org.apache.poi.ss.usermodel.CreationHelper;
+import org.apache.poi.ss.usermodel.Row;
+import org.apache.poi.ss.usermodel.Sheet;
+import org.apache.poi.ss.usermodel.Workbook;
+import org.apache.poi.xssf.usermodel.XSSFWorkbook;
+
+import java.io.IOException;
+import java.io.OutputStream;
+import java.lang.reflect.Array;
+import java.util.ArrayList;
+import java.util.List;
+
+public class ExcelGenerator {
+    private Workbook wb;
+    private CellStyle wholeNumberCellStyle;
+    private CellStyle stringCellStyle;
+    private int row = 0;
+    private List<Integer> sinkColumnsIndexInRow;
+    private SeaTunnelRowType seaTunnelRowType;
+
+    public ExcelGenerator(List<Integer> sinkColumnsIndexInRow, 
SeaTunnelRowType seaTunnelRowType) {
+        this.sinkColumnsIndexInRow = sinkColumnsIndexInRow;
+        this.seaTunnelRowType = seaTunnelRowType;
+        wb = new XSSFWorkbook();
+        Sheet st = wb.createSheet("Sheet1");
+        Row row = st.createRow(this.row);
+        for (Integer i : sinkColumnsIndexInRow) {
+            String fieldName = seaTunnelRowType.getFieldName(i);
+            row.createCell(i).setCellValue(fieldName);
+        }
+
+        wholeNumberCellStyle = createStyle(wb, "General");
+        stringCellStyle = createStyle(wb, "@");
+        this.row += 1;
+    }
+
+    public void writeData(SeaTunnelRow seaTunnelRow) {
+        Sheet st = wb.getSheet("Sheet1");

Review Comment:
   oh ,Let me modify that



-- 
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]

Reply via email to