Excel 将MS Word API转换为Aspose Word API

Excel 将MS Word API转换为Aspose Word API,excel,aspose,aspose-cells,vba,Excel,Aspose,Aspose Cells,Vba,您能提供使用MS Word将以下VB代码转换为使用Aspose Word的VB.NET的代码吗 Dim os AS Excel.Worksheet oS.Range("A55", "S55").Select() oS.Application.Selection.Copy() oS.Application.Selection.Insert(Shift:=Excel.XlDirection.xlDown) 这是最好的祝愿。在处理Excel文件时,您似乎对Aspose.Cells API而不

您能提供使用MS Word将以下VB代码转换为使用Aspose Word的VB.NET的代码吗

 Dim os AS Excel.Worksheet
 oS.Range("A55", "S55").Select()
 oS.Application.Selection.Copy()
 oS.Application.Selection.Insert(Shift:=Excel.XlDirection.xlDown)

这是最好的祝愿。

在处理Excel文件时,您似乎对Aspose.Cells API而不是Aspose.Words API的代码感兴趣

好的,根据您的共享代码,您将获得一系列单元格,使用“向下移动单元格”选项在相同的选定位置复制单元格。您可以将其转换为Aspose.Cells代码,如下所示:

'Open the Source Excel file
Dim workbook As New Workbook("C:\Test_File.xlsx")

'get cells collection of first worksheet
Dim cells As Cells = workbook.Worksheets(0).Cells


'get the source range to copy
Dim sourceRange As Range = cells.CreateRange("A55:S55")

'Insert the range below the source range 
Dim ca As CellArea = CellArea.CreateCellArea("A56", "S56")
cells.InsertRange(ca, ShiftType.Down)

' Move Source Range one Row down as Copy process has Shift Cells Down option selected
' this is only required if you have a named range and want it shifted as in Excel   
sourceRange.MoveTo(55, 0)

'create destination range
Dim destinationRange As Range = cells.CreateRange("A55:S55")

'Copy the source range data to desitnation range (newly inserted range)
destinationRange.Copy(sourceRange)

'save the resultant file
workbook.Save("C:\Test_Out.xlsx")
希望上面的代码能帮助您实现