android:hwp_manipulation
hwp manipulation
차이
문서의 선택한 두 판 사이의 차이를 보여줍니다.
양쪽 이전 판이전 판다음 판 | 이전 판 | ||
android:hwp_manipulation [2025/01/29 00:30] – 이거니맨 | android:hwp_manipulation [2025/01/29 00:42] (현재) – 이거니맨 | ||
---|---|---|---|
줄 8: | 줄 8: | ||
- | In this article, I will show you how to manipulate hwp file by using [[https:// | + | In this article, I will show you how to manipulate hwp file by using [[https:// |
+ | The [[gosohae: | ||
- | ===== hwplib ===== | + | ===== hwplib ===== |
[[https:// | [[https:// | ||
줄 17: | 줄 18: | ||
The maven repository is | The maven repository is | ||
- | https:// | + | |
| | ||
줄 31: | 줄 32: | ||
+ | ===== HWP File ===== | ||
+ | First, you must make " | ||
+ | By Ctrl + K + E, You can make " | ||
+ | This is a sample hwp file which make " | ||
+ | {{ : | ||
+ | |||
+ | |||
+ | You can save file inside your app by locating file in [res] ->[ raw] folder | ||
+ | |||
+ | {{: | ||
+ | |||
+ | |||
+ | |||
+ | ===== Sample File ===== | ||
+ | |||
+ | This is sample file of hwp manipulation | ||
+ | |||
+ | <file kotlin " | ||
+ | package com.dklaw.goso3.pdfPages | ||
+ | |||
+ | import android.content.Context | ||
+ | import android.os.Environment | ||
+ | import android.widget.Toast | ||
+ | import com.dklaw.goso3.R | ||
+ | import com.dklaw.goso3.database.CriminalSue | ||
+ | import com.dklaw.goso3.database.PlaintiffContact | ||
+ | import com.dklaw.goso3.pages.EvadeObject | ||
+ | import com.dklaw.goso3.pages.EvadeReason | ||
+ | import com.dklaw.goso3.pages.NoticeMethod | ||
+ | import com.dklaw.goso3.pages.getJsonEvadeObject | ||
+ | import com.dklaw.goso3.pages.getJsonEvadeReason | ||
+ | import com.dklaw.goso3.pages.getJsonNoticeMethod | ||
+ | import kr.dogfoot.hwplib.`object`.HWPFile | ||
+ | import kr.dogfoot.hwplib.reader.HWPReader | ||
+ | import kr.dogfoot.hwplib.tool.objectfinder.FieldFinder | ||
+ | import kr.dogfoot.hwplib.writer.HWPWriter | ||
+ | import org.json.JSONObject | ||
+ | import java.io.File | ||
+ | import java.io.FileOutputStream | ||
+ | import java.io.IOException | ||
+ | import java.text.SimpleDateFormat | ||
+ | import java.time.Instant | ||
+ | import java.util.Date | ||
+ | import java.util.Locale | ||
+ | |||
+ | |||
+ | @Throws(IOException:: | ||
+ | fun generateHWPPageEvadeInvestigator(context: | ||
+ | | ||
+ | |||
+ | try { | ||
+ | val hwpFile : HWPFile = HWPReader.fromInputStream(context.resources.openRawResource(R.raw.evadeinvestigator)) | ||
+ | |||
+ | // JSON 엘리먼트 가져오기 | ||
+ | val jsonElementObject = JSONObject(sueItem.jsonElements) | ||
+ | |||
+ | val textName = ArrayList< | ||
+ | textName.add(plaintiffInfo.pName) | ||
+ | |||
+ | val textIncidentTitle = ArrayList< | ||
+ | textIncidentTitle.add(sueItem.incidentTitle) | ||
+ | |||
+ | val jsonEvadeObject = getJsonEvadeObject(jsonElementObject) | ||
+ | val textPosition = ArrayList< | ||
+ | textPosition.add(jsonEvadeObject.position) | ||
+ | |||
+ | |||
+ | FieldFinder.setClickHereText(hwpFile, | ||
+ | FieldFinder.setClickHereText(hwpFile, | ||
+ | FieldFinder.setClickHereText(hwpFile, | ||
+ | FieldFinder.setClickHereText(hwpFile, | ||
+ | FieldFinder.setClickHereText(hwpFile, | ||
+ | FieldFinder.setClickHereText(hwpFile, | ||
+ | FieldFinder.setClickHereText(hwpFile, | ||
+ | FieldFinder.setClickHereText(hwpFile, | ||
+ | |||
+ | // 기피 이유 | ||
+ | var reason = "" | ||
+ | val jsonEvadeReason = getJsonEvadeReason(jsonElementObject) | ||
+ | if (jsonEvadeReason.victim) | ||
+ | if (jsonEvadeReason.relative) reason += "\n□ 수사관이 피의자·피해자와 친족이거나 친족관계에 있음" | ||
+ | if (jsonEvadeReason.sponsor) reason += "\n□ 수사관이 피의자·피해자의 법정대리인 또는 후견감독인임" | ||
+ | if (jsonEvadeReason.contact) reason += "\n□ 수사관이 청탁전화를 수신하는 등 피의자·피해자와 공무 외 접촉하여 공정성을 해하였음" | ||
+ | if (jsonEvadeReason.insult) reason += "\n□ 수사관이 모욕적 언행, 욕설, 가혹행위 등 인권을 침해함" | ||
+ | if (jsonEvadeReason.interfefe) reason += "\n□ 조사과정의 변호인 참여 등 신청인의 방어권을 보장하지 못함" | ||
+ | if (jsonEvadeReason.lazy) reason += "\n□ 사건 접수 후 30일 이상 아무런 수사 진행사항이 없음" | ||
+ | if (jsonEvadeReason.etc) reason += "\n□ 기타 불공평한 수사를 할 염려가 있다고 볼만한 객관적·구체적 사정이 있음" | ||
+ | |||
+ | FieldFinder.setClickHereText(hwpFile, | ||
+ | |||
+ | FieldFinder.setClickHereText(hwpFile, | ||
+ | |||
+ | // 통지방법 | ||
+ | val jsonNoticeMethod = getJsonNoticeMethod(jsonElementObject) | ||
+ | var noticeMethod = "" | ||
+ | if (jsonNoticeMethod.document) noticeMethod += " | ||
+ | if (jsonNoticeMethod.phone) noticeMethod += " 전화" | ||
+ | if (jsonNoticeMethod.sms) noticeMethod += " 문자메시지" | ||
+ | if (jsonNoticeMethod.etc) noticeMethod += " 기타 : ${jsonNoticeMethod.etcDetail}" | ||
+ | |||
+ | FieldFinder.setClickHereText(hwpFile, | ||
+ | |||
+ | // 날짜 등 | ||
+ | FieldFinder.setClickHereText(hwpFile, | ||
+ | FieldFinder.setClickHereText(hwpFile, | ||
+ | FieldFinder.setClickHereText(hwpFile, | ||
+ | |||
+ | val dir = Environment.getExternalStoragePublicDirectory(Environment.DIRECTORY_DOWNLOADS) | ||
+ | val file = File(dir, " | ||
+ | Date.from(Instant.now()))+" | ||
+ | val fos = FileOutputStream(file) | ||
+ | HWPWriter.toStream(hwpFile, | ||
+ | fos.close() | ||
+ | |||
+ | // on below line we are displaying a toast message as PDF file generated.. | ||
+ | Toast.makeText(context, | ||
+ | } catch (e: Exception) { | ||
+ | // below line is used | ||
+ | // to handle error | ||
+ | e.printStackTrace() | ||
+ | |||
+ | // on below line we are displaying a toast message as fail to generate PDF | ||
+ | Toast.makeText(context, | ||
+ | } | ||
+ | } | ||
+ | </ |
android/hwp_manipulation.1738078252.txt.gz · 마지막으로 수정됨: 2025/01/29 00:30 저자 이거니맨