本文整理汇总了C#中Aspose类的典型用法代码示例。如果您正苦于以下问题:C# Aspose类的具体用法?C# Aspose怎么用?C# Aspose使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
Aspose类属于命名空间,在下文中一共展示了Aspose类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: GridWeb1_RowDoubleClick
protected void GridWeb1_RowDoubleClick(object sender, Aspose.Cells.GridWeb.RowColumnEventArgs e)
{
string msg = "You just clicked <";
msg += "Row header: " + (e.Num + 1) + ">";
GridWeb1.Message = msg;
}
示例2: AddRow
protected void AddRow(Aspose.Pdf.Table tblInfo, string strLabel, string strValue)
{
try
{
//create a new row...
Aspose.Pdf.Row row = tblInfo.Rows.Add();
//create a new cell...
Aspose.Pdf.Cell cellLabel = row.Cells.Add();
//add value in cell...
cellLabel.Paragraphs.Add(new TextFragment(strLabel));
//set font properties...
cellLabel.DefaultCellTextState.Font = Aspose.Pdf.Text.FontRepository.FindFont("Calibri");
cellLabel.DefaultCellTextState.FontSize = 8;
cellLabel.DefaultCellTextState.FontStyle = FontStyles.Bold;
//add new cell in row...
Aspose.Pdf.Cell cell = row.Cells.Add();
//add value in the cell...
cell.Paragraphs.Add(new TextFragment(strValue));
cell.DefaultCellTextState.Font = Aspose.Pdf.Text.FontRepository.FindFont("Calibri");
cell.DefaultCellTextState.FontSize = 8;
}
catch (Exception exp)
{
msg.Text = "<div class='alert alert-danger'><button data-dismiss='alert' class='close' type='button'>×</button>Exception Occured:" + exp.Message + "</div>";
}
}
示例3: GridWeb1_RowDoubleClick
// ExEnd:ColumnDoubleClickEvent
// ExStart:RowDoubleClickEvent
// Event Handler for RowDoubleClick event
protected void GridWeb1_RowDoubleClick(object sender, Aspose.Cells.GridWeb.RowColumnEventArgs e)
{
// Displaying the number of the row (whose header is double clicked) in GridWeb's Message Box
string msg = "You just clicked <";
msg += "Row header: " + (e.Num + 1) + ">";
GridWeb1.Message = msg;
}
示例4: PutAdress
private void PutAdress(Aspose.Pdf.Generator.Pdf pdf, PassengerInfo passengerInfo)
{
//create table to add address of the customer
Table adressTable = new Table();
adressTable.IsFirstParagraph = true;
adressTable.ColumnWidths = "60 180 60 180";
adressTable.DefaultCellTextInfo.FontSize = 10;
adressTable.DefaultCellTextInfo.LineSpacing = 3;
adressTable.DefaultCellPadding.Bottom = 3;
//add this table in the first section/page
Section section = pdf.Sections[0];
section.Paragraphs.Add(adressTable);
//add a new row in the table
Row row1AdressTable = new Row(adressTable);
adressTable.Rows.Add(row1AdressTable);
//add cells and text
Aspose.Pdf.Generator.TextInfo tf1 = new Aspose.Pdf.Generator.TextInfo();
tf1.Color = new Aspose.Pdf.Generator.Color(111, 146, 188);
tf1.FontName = "Helvetica-Bold";
row1AdressTable.Cells.Add("Bill To:", tf1);
row1AdressTable.Cells.Add(passengerInfo.Name + "#$NL" +
passengerInfo.Address + "#$NL" + passengerInfo.Email + "#$NL" +
passengerInfo.PhoneNumber);
}
示例5: SetMergeAndStyle
protected static void SetMergeAndStyle(Aspose.Cells.Style style, Cells cls, int startRow, int startCol, int rowNumber, int colNumber)
{
cls.Merge(startRow, startCol, rowNumber, colNumber);
for (int i = 0; i < rowNumber; i++)
for (int j = 0; j < colNumber; j++)
cls[startRow + i, startCol + j].Style = style;
}
示例6: GridWeb1_CellDoubleClick
// ExStart:CellDoubleClickEvent
// Event Handler for CellDoubleClick event
protected void GridWeb1_CellDoubleClick(object sender, Aspose.Cells.GridWeb.CellEventArgs e)
{
// Displaying the name of the cell (that is double clicked) in GridWeb's Message Box
string msg = "You just clicked <";
msg += "Row: " + (e.Cell.Row + 1) + " Column: " + (e.Cell.Column + 1) + " Cell Name: " + e.Cell.Name + ">";
GridWeb1.Message = msg;
}
示例7: GridWeb1_CellCommand
// Uses the cell command type bind column to create a link for each row to switch to the form view.
protected void GridWeb1_CellCommand(object sender, Aspose.Cells.GridWeb.CellEventArgs e)
{
if (e.Argument.Equals("VIEWDETAIL"))
{
//Show grid form and line no
GridWebForm2.ShowForm();
GridWebForm2.LineNumber = e.Cell.Row;
}
}
示例8: GridWeb1_BindingChildView
// Handles the BindingChildView event to set the UnitPrice column.
protected void GridWeb1_BindingChildView(Aspose.Cells.GridWeb.GridWeb childGrid, Aspose.Cells.GridWeb.Data.WebWorksheet childSheet)
{
DataView view = (DataView)childSheet.DataSource;
if (view.Table.TableName == "Order Details")
{
//Set column data type
childSheet.BindColumns["UnitPrice"].NumberType = NumberType.Currency3;
}
}
示例9: RenderConvictToPdf
private void RenderConvictToPdf(Convict convict, Aspose.Pdf.Generator.Pdf pdf)
{
var section = pdf.Sections.Add();
RenderPersonInfoToSection(convict, section);
foreach (var crime in convict.Crimes)
{
RenderCrimeInfoToSection(crime,section);
}
}
示例10: PutOrder
private void PutOrder(Aspose.Pdf.Generator.Pdf pdf, PassengerInfo passengerInfo, FlightInfo flightInfo, BookingInfo bookingInfo)
{
//ticket for leaving
PutSummary(pdf, passengerInfo, bookingInfo, flightInfo, false);
//ticket for returning
PutSummary(pdf, passengerInfo, bookingInfo, flightInfo, true);
}
示例11: gridDesktop1_SelectedCellRangeChanged
private void gridDesktop1_SelectedCellRangeChanged(object sender, Aspose.Cells.GridDesktop.CellRangeEventArgs e)
{
// Checking if the range of cells is not empty
if ((e.CellRange.EndColumn - e.CellRange.StartColumn > 0) ||
(e.CellRange.EndRow - e.CellRange.StartRow > 0))
{
// Assigning the updated CellRange to global variable
range = e.CellRange;
}
}
示例12: PrintTables
// ExStart:PrintTables
public static void PrintTables(Workbook workbook, Aspose.Cells.ExternalConnections.ExternalConnection ec)
{
// Iterate all the worksheets
for (int j = 0; j < workbook.Worksheets.Count; j++)
{
Worksheet worksheet = workbook.Worksheets[j];
// Check all the query tables in a worksheet
for (int k = 0; k < worksheet.QueryTables.Count; k++)
{
Aspose.Cells.QueryTable qt = worksheet.QueryTables[k];
// Check if query table is related to this external connection
if (ec.Id == qt.ConnectionId
&& qt.ConnectionId >= 0)
{
// Print the query table name and print its refersto range
Console.WriteLine("querytable " + qt.Name);
string n = qt.Name.Replace('+', '_').Replace('=', '_');
Name name = workbook.Worksheets.Names["'" + worksheet.Name + "'!" + n];
if (name != null)
{
Range range = name.GetRange();
if (range != null)
{
Console.WriteLine("refersto: " + range.RefersTo);
}
}
}
}
// Iterate all the list objects in this worksheet
for (int k = 0; k < worksheet.ListObjects.Count; k++)
{
ListObject table = worksheet.ListObjects[k];
// Check the data source type if it is query table
if (table.DataSourceType == Aspose.Cells.Tables.TableDataSourceType.QueryTable)
{
// Access the query table related to list object
QueryTable qt = table.QueryTable;
// Check if query table is related to this external connection
if (ec.Id == qt.ConnectionId
&& qt.ConnectionId >= 0)
{
// Print the query table name and print its refersto range
Console.WriteLine("querytable " + qt.Name);
Console.WriteLine("Table " + table.DisplayName);
Console.WriteLine("refersto: " + worksheet.Name + "!" + CellsHelper.CellIndexToName(table.StartRow, table.StartColumn) + ":" + CellsHelper.CellIndexToName(table.EndRow, table.EndColumn));
}
}
}
}
}
开发者ID:aspose-cells,项目名称:Aspose.Cells-for-.NET,代码行数:56,代码来源:FindQueryTablesAndListObjectsOfExternalDataConnections.cs
示例13: Print
//ExStart
//ExId:XpsPrint_PrintDocument
//ExSummary:Convert an Aspose.Words document into an XPS stream and print.
/// <summary>
/// Sends an Aspose.Words document to a printer using the XpsPrint API.
/// </summary>
/// <param name="document"></param>
/// <param name="printerName"></param>
/// <param name="jobName">Job name. Can be null.</param>
/// <param name="isWait">True to wait for the job to complete. False to return immediately after submitting the job.</param>
/// <exception cref="Exception">Thrown if any error occurs.</exception>
public static void Print(Aspose.Words.Document document, string printerName, string jobName, bool isWait)
{
if (document == null)
throw new ArgumentNullException("document");
// Use Aspose.Words to convert the document to XPS and store in a memory stream.
MemoryStream stream = new MemoryStream();
document.Save(stream, Aspose.Words.SaveFormat.Xps);
stream.Position = 0;
Print(stream, printerName, jobName, isWait);
}
示例14: MailMerge_MergeField
private void MailMerge_MergeField(object sender, Aspose.Words.Reporting.MergeFieldEventArgs e)
{
#region 處理照片
if (e.FieldName == "照片")
{
DocumentBuilder builder1 = new DocumentBuilder(e.Document);
builder1.MoveToField(e.Field, true);
byte[] photoBytes = null;
try
{
photoBytes = Convert.FromBase64String("" + e.FieldValue);
}
catch (Exception ex)
{
//builder1.Write("照片粘貼處");
e.Field.Remove();
return;
}
if (photoBytes == null || photoBytes.Length == 0)
{
//builder1.Write("照片粘貼處");
e.Field.Remove();
return;
}
e.Field.Remove();
Shape photoShape = new Shape(e.Document, ShapeType.Image);
photoShape.ImageData.SetImage(photoBytes);
photoShape.WrapType = WrapType.Inline;
#region AutoResize
double origHWRate = photoShape.ImageData.ImageSize.HeightPoints / photoShape.ImageData.ImageSize.WidthPoints;
double shapeHeight = (builder1.CurrentParagraph.ParentNode.ParentNode as Row).RowFormat.Height;
double shapeWidth = (builder1.CurrentParagraph.ParentNode as Cell).CellFormat.Width;
if ((shapeHeight / shapeWidth) < origHWRate)
shapeWidth = shapeHeight / origHWRate;
else
shapeHeight = shapeWidth * origHWRate;
#endregion
photoShape.Height = shapeHeight * 0.9;
photoShape.Width = shapeWidth * 0.9;
builder1.InsertNode(photoShape);
}
#endregion
}
示例15: AsposeCreateCell
public void AsposeCreateCell(Aspose.Words.DocumentBuilder builder, double width, string text)
{
builder.InsertCell();
builder.CellFormat.Borders.LineStyle = Aspose.Words.LineStyle.Single;
builder.CellFormat.Borders.Color = System.Drawing.Color.Black;
builder.CellFormat.Width = width;//单元格的宽度
builder.CellFormat.LeftPadding = 3;//单元格的左内边距
builder.CellFormat.RightPadding = 3;//单元格的右内边距
builder.RowFormat.Height = 20;//行高
builder.CellFormat.VerticalMerge = Aspose.Words.Tables.CellMerge.None;
builder.CellFormat.VerticalAlignment = Aspose.Words.Tables.CellVerticalAlignment.Center;//垂直居中对齐
builder.ParagraphFormat.Alignment = Aspose.Words.ParagraphAlignment.Center;//水平居中对齐
builder.Write(text);
}