2017-11-22 7 views
1

apache poi xslf를 사용하여 텍스트 상자를 만든 다음 글 머리 기호를 추가합니다. 문제는 글 머리 멀티 라인 텍스트 인 경우,이올바른 텍스트 apache poi를 사용하는 글 머리 기호가있는 경우

혼용 분석과 같은 추가하는, NGRAM, 나이브 베이 즈 텍스트 분류가 위에서

만들어지고 대화, 감정과 불만의 위험의 본질을 파악하는 것입니다 글 머리 기호 대화가이

  • 텍스트 분석과 같은 총알 라인, 즉 텍스트 정렬 단어 텍스트 정렬해야 NGRAM, 나이브 베이 즈 텍스트 분류는
    의 성격 대화 감정과 불만의 위험이 만들어지고를 식별합니다.

다음는 어떤 도움에 감사드립니다 코드

XSLFTextBox textbox = this.slide.createTextBox(); 
textbox.setAnchor(new Rectangle(this.xAxis,this.yAxis,this.width,this.height)); XSLFTextParagraph contentPara = textbox.addNewTextParagraph(); 
XSLFTextRun bullet1TR = contentPara.addNewTextRun();  contentPara.setBullet(true); 
contentPara.setFontAlign(FontAlign.TOP); contentPara.setTextAlign(TextAlign.LEFT); 

입니다. 감사합니다. .

+0

"어떤 도움에 감사드립니다."정말? 왜냐하면 내가 너를 돕고 나서 너 한테 아무런 피드백도받지 못했기 때문이야. 이것은 전혀 감사하지 않는 것 같습니다. –

+0

죄송합니다, 방금 대답을 확인하고 시도하고 예상대로 작동합니다. 고마워요 :) 나는 당신의 대답을 올바른 것으로 표시했습니다. 고마워요! – user3768904

답변

2

처음에는 전체 단락에 글 머리 기호에 공백이있는만큼 들여 쓰기해야합니다. 그런 다음 첫 번째 행에는 동일한 너비의 행 들여 쓰기가 있어야하기 때문에 첫 번째 행에는 글 머리 기호가 들어있어 합계로 들여 쓰이지 않습니다.

예 :

import java.io.FileOutputStream; 

import org.apache.poi.xslf.usermodel.*; 
import org.apache.poi.sl.usermodel.*; 

import java.awt.Rectangle; 

public class CreatePPTXTextBoxBullet { 

public static void main(String[] args) throws Exception { 

    XMLSlideShow slideShow = new XMLSlideShow(); 

    XSLFSlide slide = slideShow.createSlide(); 

    XSLFTextBox textbox = slide.createTextBox(); 
    textbox.setAnchor(new Rectangle(50, 100, 570, 100)); 
    XSLFTextParagraph paragraph = textbox.addNewTextParagraph(); 
    paragraph.setBullet(true); 
    paragraph.setLeftMargin(25.2); //left margin = indent for the text; 25.2 pt = 25.2/72 = 0.35" 
    paragraph.setIndent(-25.2); //hanging indent first row for the bullet point; -25.2 pt, so first row indent is 0.00 in sum 
    paragraph.setFontAlign(TextParagraph.FontAlign.TOP); 
    paragraph.setTextAlign(TextParagraph.TextAlign.LEFT); 
    XSLFTextRun run = paragraph.addNewTextRun(); 
    run.setText("Text analysis, nGram, Naïve Bayes Text Classifier to identify the nature of the conversation, sentiment and risk of complaint being made"); 

    FileOutputStream out = new FileOutputStream("CreatePPTXTextBoxBullet.pptx"); 
    slideShow.write(out); 
    out.close(); 
} 
} 
+0

고마워요. 방금 시도했는데 작동 중입니다. 감사합니다. :) – user3768904