Comments (11)
Hangul supports Text Wrapping by LineChange property in ListHeaderForTextBox Object.
The value of this attribute can be obtained as follows.
Section s = hwpFile.getBodyText().getSectionList().get(0);
Paragraph firstParagraph = s.getParagraph(0);
ControlRectangle rect = (ControlRectangle) firstParagraph.getControlList().get(2);
System.out.println(rect.getTextBox().getListHeader().getProperty().getLineChange());
If This property value is Normal, Texts have warpped.
And, I think LineSeqItem seems to store a pre-calculated value to draw a Hangul file quickly.
The text is drawn well without the LineSeqItem, except for the text line's space function.
LineSeqItem.textStartPosition is the text start position of the line represented by LineSeqItem in the full text of the paragraph. The figure above shows that the second line starts at index 2( zero-based).
from hwplib.
ok, i find the cell's listHeader also have the ListHeaderPropertyForCell
same setLineChange
method .
i check the property is Normal
the file open look like:
i'am not use the text box just use the cell for contain text.
maybe i should be send the .hwp file and code for you ?
from hwplib.
yes. I want you to send them.
from hwplib.
i test the text sure warped,but some word not show full
from hwplib.
i find the problem, when i set the ParaShape
for Paragraph the cell content will be not warp.
ParaShape paraShape = hwpFile.getDocInfo().addNewParaShape();
paraShape.getProperty1().setAlignment(Alignment.Left);
int id = hwpFile.getDocInfo().getParaShapeList().size() - 1;
ph.setParaShapeId(id);
but i don't know how fix it,
the new code has send for you mail.
from hwplib.
hello ,do you receive my email? if you have any question you can give me feedback.
thank you
from hwplib.
According to my testing, we need a LineSegItem object for each line segmented for text-wrapping. However, the value of the TextStartPositon property in the LineSegItem object is hard to compute. So, I did not create any LineSegItem objects. And I set the value of the LineSpace property on the ParaShape object that is not in your code.
If you save this file again from Hangul, LineSegItem is automatically created.
Look at my attachment.
from hwplib.
thank you.
i try you code ,it's work for auto text-wrapping.
you say
the TextStartPositon property in the LineSegItem object is hard to compute
it mean if i need set text wrapping by hand then must be compute the LineSegItem's TextStartPositon
property ?
from hwplib.
in my program i'm use the \n
to mark break line,
so i just easy compute the postion.
this is my code:
private void setLineBreak(String text,Paragraph firstParagraph, int width){
ParaLineSeg lineSeg = firstParagraph.getLineSeg();
if (text.contains("\n")) {
int i =-1;
while ((i=text.indexOf("\n", i+1 ))!=-1){
LineSegItem lineSegItem = lineSeg.addNewLineSegItem();
lineSegItem.setTextPartHeight(1000);
lineSegItem.setStartPositionFromColumn(0);
lineSegItem.setDistanceBaseLineToLineVerticalPosition(850);
lineSegItem.setLineSpace(100);
lineSegItem.setSegmentWidth(width);
lineSegItem.setTextStartPositon(i);
lineSegItem.getTag().setFirstSegmentAtLine(true);
lineSegItem.getTag().setLastSegmentAtLine(true);
}
}
}
thank you for you answer.
from hwplib.
if you receive any donate, i wish do it.
such as digital cash: eth or bitcoin ete.
from hwplib.
In principle, the value of LineSegItem's TextStartPositon is the start of the string in a line break. If the string "ABCD EDFG" is divided as follows
ABCD
EDFG
Two LineSegItems are required, and TextStartPositon values must be set to 0 and 5, respectively.
Typical word processing programs do not need this value, but Hangul seems to be needed for quick drawing. To get the TextStartPositon value, you should actually draw the all paragraph attribute and the all character attribute on the string. It's awkward until you know well about word processor programming.
And your contribution will be appreciated.
I get my first donation. Thank you for giving me this experience.
BTC address
3JvZNB8P6CR3CEJmn3dDwasqjtDJRvD6qQ
[email protected]
from hwplib.
Related Issues (20)
- 한글파일 5.1.0.1 버전 변환안됨에 따른 문의 HOT 1
- HWPReader.fromFile에서
- 안녕하세요. 질문사항이 있어 글 올립니다.^^ HOT 2
- 얼마전에 질문 드렸던 사람인데요 HOT 7
- 안녕하세요. 라이브러리 관련하여 문의 드립니다.. HOT 2
- 가로정렬시 텍스트 겹침문제 HOT 4
- 안녕하세요! 테이블 관련해서 문의 드립니다. HOT 4
- ParagraphAdder를 통해 파일복사 시 복사한 파일의 개요문단 수준이 1로 고정되는 현상 HOT 2
- 누름틀에 값 입력 시 발생하는 현상 문의드립니다. HOT 2
- 특정 문서에서 문서의 개요를 지정한 형태로 읽지 못하는 현상 HOT 2
- 안녕하세요 테이블 관련 문의 드립니다! HOT 1
- 안녕하세요 오류 This is not paragraph. 질문 드립니다 HOT 10
- 안녕하세요, 상용 HWP 라이브러리 구입 문의 드립니다. HOT 1
- 한글 2024 버전의 파일을 읽지 못하는 경우가 발생합니다. HOT 2
- hwp 파일을 읽고 html 변환 HOT 5
- 안녕하세요. 라이브러리 사용중 궁금한점이 있어서 문의드립니다. HOT 4
- 안녕하세요. 테이블 셀 색상 관련해서 문의드립니다. HOT 1
- 폰트 색상 관련하여 질문드립니다. HOT 1
- 안녕하세요, 최신 JAR을 어디서 구할 수 있나요? (Hi, do you know where I can get the latest JAR?) HOT 1
- 1.1.5 버전 CtrlHeaderGso 클래스의 unkown 참조 이슈 HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from hwplib.