Adds one line with the specified coordinates and properties.
Syntax
| Visual Basic (Declaration) | |
|---|
Public Sub AddLine( _
ByVal li As LineInfo _
) |
| Visual Basic (Usage) | Copy Code |
|---|
Dim instance As DDSheet
Dim li As LineInfo
instance.AddLine(li)
|
Parameters
- li
- A LineInfo object with its members set to the proper line configuration values. See the LineInfo class for more information.
Example
| C# | Copy Code |
|---|
private void btnSpread_Click(object
sender, System.EventArgs e)
{
//Dimension a Workbook and add a sheet to its Sheets collection
DataDynamics.SpreadBuilder.Workbook sb = new DataDynamics.SpreadBuilder.Workbook();
sb.Sheets.AddNew();
//Set up properties and values for columns, rows and cells as desired
sb.Sheets[0].Name = "Customer Call List";
sb.Sheets[0].Columns(0).Width = 2 * 1440;
sb.Sheets[0].Columns(1).Width = 1440;
sb.Sheets[0].Columns(2).Width = 1440;
sb.Sheets[0].Rows(0).Height = 1440/4;
//Header row
sb.Sheets[0].Cell(0,0).SetValue("Company Name");
sb.Sheets[0].Cell(0,0).FontBold = true;
sb.Sheets[0].Cell(0,1).SetValue("Contact Name");
sb.Sheets[0].Cell(0,1).FontBold = true;
sb.Sheets[0].Cell(0,2).SetValue("Phone");
sb.Sheets[0].Cell(0,2).FontBold = true;
//First row of data
sb.Sheets[0].Cell(1,0).SetValue("Data Dynamics");
sb.Sheets[0].Cell(1,1).SetValue("Mortimer");
sb.Sheets[0].Cell(1,2).SetValue("(614) 895-3142");
DataDynamics.SpreadBuilder.Imaging.LineInfo l = new DataDynamics.SpreadBuilder.Imaging.LineInfo();
l.colL = 3; //starting column for the line
l.Color = System.Drawing.Color.Salmon; //color for the line
l.colR = 8; //ending column for the line
l.dxL = 50;
l.dxR = 60;
l.dyB = 80;
l.dyT = 10;
l.EndAHLength = DataDynamics.SpreadBuilder.Imaging.LineArrowHeadLengths.Long; //length of the ending arrowhead
l.EndAHStyle = DataDynamics.SpreadBuilder.Imaging.LineArrowHeadStyles.DoubleEndedOpen; //style of the ending arrowhead
l.EndAHWidth = DataDynamics.SpreadBuilder.Imaging.LineArrowHeadWidths.Wide; //width of
the ending arrowhead
l.fAuto = true;
l.iQu = DataDynamics.SpreadBuilder.Imaging.ObjectDirection.UpperLeftToLowerRight; //direction of the line
l.MoveType = DataDynamics.SpreadBuilder.Imaging.SBFloatingMoveType.MoveSize; //sets
whether user will be able to move and/or resize the line
l.rwB = 8; //bottom row for the line
l.rwT = 1; //top row for the line
l.StartAHLength = DataDynamics.SpreadBuilder.Imaging.LineArrowHeadLengths.Long; //length of the starting arrowhead
l.StartAHStyle = DataDynamics.SpreadBuilder.Imaging.LineArrowHeadStyles.DoubleEndedOpen; //style of the starting arrowhead
l.StartAHWidth = DataDynamics.SpreadBuilder.Imaging.LineArrowHeadWidths.Wide;
l.Style = DataDynamics.SpreadBuilder.Imaging.LineStyles.Dash; //style of the line
l.Weight = 5; //thickness of the line
sb.Sheets[0].AddLine(l);
//Save the Workbook to an Excel file
sb.Save (Application.StartupPath + @"\x.xls");
MessageBox.Show("Your Spreadsheet, " + sb.Sheets[0].Columns(0).OwnerSheet.Name
+ ", has been saved to " + Application.StartupPath + "\\x.xls");
} |
| Visual Basic | Copy Code |
|---|
Private Sub btnSpread_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnSpread.Click
Dim sb As New DataDynamics.SpreadBuilder.Workbook
sb.Sheets.AddNew()
With sb.Sheets(0)
.Name = "Customer Call List"
.Columns(0).Width = 2 * 1440
.Columns(1).Width = 1440
.Columns(2).Width = 1440
.Rows(0).Height = 1440 / 4
.Rows(0).AutoSize = False
.Cell(0, 0).SetValue("Company Name")
.Cell(0, 0).FontBold = True
.Cell(0, 1).SetValue("Contact Name")
.Cell(0, 1).FontBold = True
.Cell(0, 2).SetValue("Phone")
.Cell(0, 2).FontBold = True
.Cell(1, 0).SetValue("Data Dynamics")
.Cell(1, 1).SetValue("Mortimer")
.Cell(1, 2).SetValue("(614) 895-3142")
End With
Dim l As New DataDynamics.SpreadBuilder.Imaging.LineInfo
With l
.colL = 3
.Color = System.Drawing.Color.Salmon
.colR = 8
.dxL = 50
.dxR = 60
.dyB = 80
.dyT = 10
.EndAHLength = DataDynamics.SpreadBuilder.Imaging.LineArrowHeadLengths.Long
.EndAHStyle = DataDynamics.SpreadBuilder.Imaging.LineArrowHeadStyles.DoubleEndedOpen
.EndAHWidth = DataDynamics.SpreadBuilder.Imaging.LineArrowHeadWidths.Wide
.fAuto = True
.iQu = DataDynamics.SpreadBuilder.Imaging.ObjectDirection.UpperLeftToLowerRight
.MoveType = DataDynamics.SpreadBuilder.Imaging.SBFloatingMoveType.MoveSize
.rwB = 8
.rwT = 1
.StartAHLength = DataDynamics.SpreadBuilder.Imaging.LineArrowHeadLengths.Long
.StartAHStyle = DataDynamics.SpreadBuilder.Imaging.LineArrowHeadStyles.DoubleEndedOpen
.StartAHWidth = DataDynamics.SpreadBuilder.Imaging.LineArrowHeadWidths.Wide
.Style = DataDynamics.SpreadBuilder.Imaging.LineStyles.Dash
.Weight = 5
End With
sb.Sheets(0).AddLine(l)
sb.Save(Application.StartupPath & "\x.xls")
MsgBox("Your Spreadsheet, " & sb.Sheets(0).Columns(0).OwnerSheet.Name & ", has been saved to " & Application.StartupPath & "\x.xls")
End Sub |
See Also