- Option Strict Off
- Imports SpreadsheetGear
- Imports System.Windows.forms
- Namespace ExcelViewVBDotnet
- Public Class StandardInterface '自定义名称
- '预留位置1
- '预留位置2
- Dim AW As SpreadsheetGear.IWorkbook,Range As SpreadsheetGear.IRange
- Dim dr As Integer
- Public Sub Workbook_Open(OldRoot As Object,NewRoot As Object,Excel As SpreadsheetGear.Windows.Forms.WorkbookView)
- Excel.GetLock()
- AW = Excel.ActiveWorkbook
- Range = AW.ActiveWorksheet.Range
- Excel.ReleaseLock()
- End Sub'打开时执行事件
- Public Sub RangeSelection(sender As Object,e As SpreadsheetGear.Windows.Forms.RangeSelectionChangedEventArgs)
- 'MessageBox.show("测试")
- End Sub'单元格选择后执行的事件
- Public Sub RangeChanged(sender As Object,e As SpreadsheetGear.Windows.Forms.RangeChangedEventArgs)
- End Sub'单元格编辑完成后执行事件
- Public Sub ButtunClick(sender As Object,e As SpreadsheetGear.Windows.Forms.ShapeActionEventArgs)
- AW.WorkbookSet.GetLock()
- If e.Shape.Name = "Button Select" Then
- AW.Worksheets("标签打印").Select()
- End If
- If e.Shape.Name = "Button Copy" Then
- AW.Worksheets("标签打印").Range("A7:F" & dr + 18 & "").EntireRow.Delete()
- dr = (Int(AW.Worksheets("固定资产档案").Range("T_358").RowCount / 3) + 1) * 6 + 6
- AW.Worksheets("标签打印").Range("A1:F6").AutoFill(destination:=AW.Worksheets("标签打印").Range("A1:F" & dr & ""), autoFillType:=AutoFillType.FillDefault)
- Dim x, y, m As Integer
- Dim a1, a2 As String
- m = 9
- For x = 6 To dr - 6 Step 6
- For y = 0 To 5 Step 2
- a1 = AW.ActiveWorksheet.Cells(x, y).Address
- a2 = AW.ActiveWorksheet.Cells(x, y + 1).Address
- AW.Worksheets("标签打印").Range(a1 + ":" + a2).Merge()
- AW.Worksheets("标签打印").Cells(x + 1, y + 1).Value = AW.Worksheets("固定资产档案").Cells(m, 0).Value
- AW.Worksheets("标签打印").Cells(x + 2, y + 1).Value = AW.Worksheets("固定资产档案").Cells(m, 1).Text
- AW.Worksheets("标签打印").Cells(x + 3, y + 1).Value = AW.Worksheets("固定资产档案").Cells(m, 2).Value
- AW.Worksheets("标签打印").Cells(x + 4, y + 1).Value = AW.Worksheets("固定资产档案").Cells(m, 5).Value
- AW.Worksheets("标签打印").Cells(x + 5, y + 1).Value = AW.Worksheets("固定资产档案").Cells(m, 10).Value
- m = m + 1
- Next y
- AW.Worksheets("标签打印").Cells(x + 6, 0).RowHeight = 27
- Next x
- AW.Worksheets("标签打印").Cells(6, 0).RowHeight = 27
- End If
- AW.WorkbookSet.ReleaseLock()
- End Sub'按钮/标签点击事件
- Public Sub FollowHyperlink(sender As Object)
- End Sub '暂不支持
- End Class
- '注:除事件字眼下可以自定义代码外的所有代码不允许改动,否则编译将有可能失败。
- End Namespace
复制代码
修复重复生成时提示的问题 |
|
tony-zyh