Code Monkey home page Code Monkey logo

Comments (7)

neolord0 avatar neolord0 commented on June 26, 2024

안녕하세요.
사용한 함수의 종류나 hwp 파일의 구조가 다르면 테스트할 때 다른 결과가 나옵니다.
테스트 하신 소스랑 hwp파일을 올려 주시면 제가 테스트 하는데 도움이 될 거 같습니다.

from hwplib.

kwonhyun avatar kwonhyun commented on June 26, 2024

아..늦어서 죄송합니다. 여기다가 커밋을 하라는 말씀이신가요?

from hwplib.

nameofSEOKWONHONG avatar nameofSEOKWONHONG commented on June 26, 2024

아..늦어서 죄송합니다. 여기다가 커밋을 하라는 말씀이신가요?

개발중인 repository를 링크로 걸거나, 해당되는 소스 부분을 직접 기입하시면 될 것 같습니다.

from hwplib.

neolord0 avatar neolord0 commented on June 26, 2024
스크린샷 2023-11-16 오전 8 28 26

이 이미지의 클립 모양의 버튼을 누르면 파일 첨부할 수 있습니다.

from hwplib.

kwonhyun avatar kwonhyun commented on June 26, 2024

필드값 구하기
한글 파일 첨부가 안되서 이미지로 첨부했습니다.
제가 사용한 코드는 Inserting_image_Cell.java에 있던
ArrayList cellList = CellFinder.findAll(hwpFile, "(_ TEST 1_)");
입니다. 이 때 cellList가 Null이 되었습니다.

그냥 단순한 표 하나 만들고 나서 표의 cell에 이름 부여하고 이미지를 넣으면 되는데 제가 드린 이미지와 같이 표의 셀에 다시 테이블을 만들고 셀필드명 설정 후 해당 필드에 이미지를 넣으려고 했을 때 이미지가 들어가지 않아서 보니까 중첩된 표의 셀은 찾아오지 못 하더라구요.

누름틀의 경우는 해당 누름틀 안에 있는 값은 제대로 가져오는데 셀은 셀 자체도 찾아오지 못하니까 값은 더더욱 못 구하게 되는 거우요..

그런데 neolord0님께서는 된다고 하시니 제가 잘 못 썼을 거 같긴 하지만 어떤 걸 사용해야 될지 잘 모르겠네요..^^;;;;;

from hwplib.

neolord0 avatar neolord0 commented on June 26, 2024

찾는 방법이 여러가지 라.. 이전에 말씀드린 것과 다르게 문제가 있더군요.
말씀해 주신 CellFinder.findAll()로 테스트 해보니..
셀 안쪽에 개체들을 검색하지 않은 것으로 확인됐습니다.
수정해서 올렸으니.. 받아서 테스트 해보세요..

from hwplib.

kwonhyun avatar kwonhyun commented on June 26, 2024
public static ArrayList getCellFieldText(HWPFile hwpFile, String fieldName) {
        ArrayList celList = CellFinder.findAll(hwpFile, fieldName);
        ArrayList fileValueList = new ArrayList<>();
        int i = 0;
        for (Cell cell : celList) {
            Paragraph firstPara = cell.getParagraphList().getParagraph(0);
            ParaText paraText = firstPara.getText();
            String content = "";
            if (paraText != null) {
                try {
                    content = paraText.getNormalString(i);
                } catch (UnsupportedEncodingException e) {
                    e.printStackTrace();
                }
                if (null != content && !"".equals(content)) {
                    fileValueList.add(content);
                }
            }
        }
        
        
        return fileValueList;
    }

이렇게 해서 모든 필드들의 값을 가져오게 했더니 잘 됩니다..^^;
방법이 이게 맞을......것 같다는 생각에 했지만요..^^;
이제 다시 응용해보기로 해야겠네요..
도와 주셔서 감사합니다~^^;

from hwplib.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.