| | |
| | | public class ExcelToJsonConverter { |
| | | |
| | | public static void main(String[] args) { |
| | | String excelFilePath = "src/main/resources/JsonFile/alarm.xlsx"; |
| | | String excelFilePath = "src/main/resources/JsonFile/PlcdownGlass.xlsx"; |
| | | String sheetName = "Sheet1"; |
| | | int addressColumnIndex = 0; |
| | | int nameColumnIndex = 1; |
| | | |
| | | //int unitColumnIndex = 2; |
| | | String outputFilePath = "src/main/resources/JsonFile/PlcAlarm.json"; |
| | | String outputFilePath = "src/main/resources/JsonFile/PlcdownGlass.json"; |
| | | |
| | | try (Workbook workbook = new XSSFWorkbook(new FileInputStream(excelFilePath))) { |
| | | Sheet sheet = workbook.getSheet(sheetName); |
| | |
| | | LinkedHashMap<String, Object> resultObject = new LinkedHashMap<>(); |
| | | resultObject.put("plcAddressBegin", "DB100.0"); |
| | | resultObject.put("plcAddressLenght", String.valueOf(plcAddressLength)); |
| | | // resultObject.put("dataType", "word"); |
| | | resultObject.put("dataType", "bit"); |
| | | resultObject.put("dataType", "word"); |
| | | // resultObject.put("dataType", "bit"); |
| | | resultObject.put("parameteInfor", jsonList); |
| | | |
| | | Gson gson = new Gson(); |