2017-03-31 12 views
0

아래 코드를 사용하면 최대 10 개 행을 추가 할 수 있습니다. 더 많은 행을 추가하려고하면 Aspose에서 예외가 발생합니다.Aspose.Word - 템플릿에서 기존 테이블에 10 개 이상의 행을 추가 할 수 없습니다.

Try 
    Dim doc As Document = New Document("C:\Users\reddy\Desktop\Junk\Out.doc") 
    Dim table As Table = DirectCast(doc.GetChild(NodeType.Table, 0, True), Table) 
    For i As Integer = 0 To 10 
     Dim clonedRow As Row = DirectCast(table.LastRow.Clone(True), Row) 
     For Each cell As Cell In clonedRow.Cells 
      cell.CellFormat.Orientation = TextOrientation.Horizontal 
      cell.CellFormat.WrapText = True 
      cell.CellFormat.FitText = True 
      cell.FirstParagraph.Runs.Clear() 
      cell.FirstParagraph.AppendChild(New Aspose.Words.Run(doc, "hellotext")) 
     Next 
     ' Add the row to the end of the table. 
     table.AppendChild(clonedRow) 
    Next 

    doc.Save("C:\Users\reddy\Desktop\Junk\Out1.pdf") 

Catch x As Exception 
    Dim y As String = "" 
End Try 

는 예외 : [Exception[1]

스택 추적 :

at System.Collections.ArrayList.get_Item(Int32 index) 
    at    .(    , Int32 , Boolean) 
    at    .(ArrayList , Boolean) 
    at    .(ArrayList , Int32) 
    at    .(ArrayList ,    , Int32 , Boolean , Boolean) 
    at    . (Table) 
    at    .(Table , Boolean) 
    at    .(Table , Stack , Boolean) 
    at    .VisitTableEnd(Table) 
    at Aspose.Words.CompositeNode.AcceptCore(DocumentVisitor visitor) 
    at Aspose.Words.CompositeNode.AcceptChildren(DocumentVisitor visitor) 
    at Aspose.Words.CompositeNode.AcceptCore(DocumentVisitor visitor) 
    at Aspose.Words.CompositeNode.AcceptChildren(DocumentVisitor visitor) 
    at Aspose.Words.CompositeNode.AcceptCore(DocumentVisitor visitor) 
    at Aspose.Words.CompositeNode.AcceptChildren(DocumentVisitor visitor) 
    at Aspose.Words.CompositeNode.AcceptCore(DocumentVisitor visitor) 
    at    .(   ) 
    at    .(Document , ​  ) 
    at    .(    ,    ) 
    at    .      (   ) 
    at    .      (   ) 
    at Aspose.Words.Document.(Stream , String , SaveOptions) 
    at Aspose.Words.Document.Save(String fileName) 
    at WindowsApplication1.IMPlanSetupTest.newpdfgen() in C:\Projects\BFL\Source\BFL.WindowsApplication1\IMPlanSetupTest.vb:line 63 

나는 가지 여기에이 작품 강타하고있다. For i As Integer = 0 To 10을 10 미만의 숫자로 변경하면 작동합니다.

+0

이 질문은 또한 여기에 게시됩니다. https://www.aspose.com/community/forums/833824/unable-to-add-more-than-10-rows-to-an-existing-table-from-template /showthread.aspx#833824 – Reddy

+0

10 개 이상의 행에 대한 코드가 제대로 작동합니다. 문제를 재현하려면 원본 문서를 공유하십시오. –

+0

다른 예제를 테스트 한 결과 같은 문제가 있습니다. 이 문제를 재현하는 가장 좋은 방법은 크기가 5 (행) x1 (열) 인 테이블로 작업 문서를 만든 다음 위의 코드를 사용하여 99 개의 행을 추가하는 것입니다. 위와 동일한 예외가있어 실패합니다. – Reddy

답변

0

위에서 언급 한 @Tilal과 마찬가지로이 제한은 aspose의 평가판 때문입니다. 적절한 라이센스를 적용한 후 10 개 이상의 행을 문서에 삽입 할 수 있습니다.

건배.