使用以下代码,我最多可以添加10行。当我尝试添加更多行时,Aspose会抛出异常。
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
例外: [
堆栈追踪:
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 :(得分:0)
正如上面提到的@Tilal,这个限制是由aspose的评估版本引起的。应用适当的许可证后,我可以在文档中插入10行以上。
干杯。