2017-11-21 2 views

답변

2

다음 코드를 사용해보십시오.

Document doc = new Document(MyDir + "in.docx"); 
DocumentBuilder builder = new DocumentBuilder(doc); 

builder.ParagraphFormat.Alignment = ParagraphAlignment.Center; 

// Insert caption above the Table 
builder.MoveTo(doc.FirstSection.Body.Tables[0].PreviousSibling); 
builder.Write("Table: "); 
builder.InsertField(@"SEQ Table \* ARABIC", ""); 

// Insert caption below the Figure 
builder.MoveToDocumentEnd(); 
builder.InsertParagraph(); 
builder.Write("Figure: "); 
builder.InsertField(@"SEQ Figure \* ARABIC", ""); 

doc.UpdateFields(); 

doc.Save(MyDir + @"17.11.docx"); 

개발자 대상 개발자로서 Aspose와 협력합니다.

+0

감사하지만 System.ArgumentNullException이 "builder.MoveTo (doc.FirstSection.Body.Tables [0] .PreviousSibling);"에서 발생했습니다. " –

+0

우편 번호를 입력하고 ** 입력 ** Word 문서 및 ** Dropbox에 대한 최종 결과를 보여주는 ** 예상 ** Word 문서를 업로드하고 테스트 용으로 여기에 다운로드 링크를 공유하십시오. Microsoft Word를 사용하여 원하는 Word 문서를 만들 수 있습니다. 저는 Aspose와 Developer Evangelist로 일합니다. –

관련 문제