/
javapractice
/
JavaPractice
Обзор
Документация
Войти
/
javapractice
/
JavaPractice
Код
Запросы
0
Задачи
Вики
Пакеты
0
Релизы
2
CI/CD
Аналитика
develop
ApachePOI/src/main/java/App.java
39 строк
2 KB
Zexa91x0
Apache POI - PriceGetterT2
30 май 2021, 20:52
30 май 2021, 20:52
258db9c
Код
Авторство
О чём код?
import org.apache.poi.openxml4j.exceptions.InvalidFormatException; import utils.*; import java.io.File; import java.io.IOException; import java.util.Calendar; public class App { public static void main(String[] args) throws IOException, InvalidFormatException { String filePath = "ApachePOI\\src\\main\\resources\\template.xlsx"; String megafonPath = "ApachePOI\\src\\main\\resources\\Megafon.xls"; String mtsPath = "ApachePOI\\src\\main\\resources\\MTS.xlsx"; String t2Path = "ApachePOI\\src\\main\\resources\\Tele2.pdf"; String newFilePath = "ApachePOI\\src\\main\\resources\\" + Calendar.getInstance().get(Calendar.YEAR) + "." + (Calendar.getInstance().get(Calendar.MONTH)+1) + "." + Calendar.getInstance().get(Calendar.DAY_OF_MONTH) +".MonthlyCellReport.xlsx"; // AllocationsDB allocationsDB = new AllocationsDB(new XLSXLoader(new File(filePath)).getWorkbook().getSheetAt(0), 241); AllocationsDB allocationsDB = new AllocationsDB(new XLSXLoader(new File(filePath)).getWorkbook().getSheetAt(0), 241); // загружаю полученные данные в Allocations для Megafon PriceInjector.injectPrice(new PriceGetterMegafon(new File(megafonPath)), allocationsDB); // загружаю полученные данные в Allocations для MTS PriceInjector.injectPrice(new PriceGetterMTS(new File(mtsPath)), allocationsDB); // загружаю полученные данные в Allocations для Tele2 PriceInjector.injectPrice(new PriceGetterT2(new File(t2Path)), allocationsDB); // allocationsDB.printAllocations(); // создаем книгу экселя и лист XLSXSaver.exportToNewXLSX(allocationsDB, newFilePath); } }