本文整理汇总了C#中Novacode.Formatting类的典型用法代码示例。如果您正苦于以下问题:C# Formatting类的具体用法?C# Formatting怎么用?C# Formatting使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
Formatting类属于Novacode命名空间,在下文中一共展示了Formatting类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: CreateDocFizicko
public void CreateDocFizicko()
{
string fileName = @"Правни лица/" + Business.BusinessName + "/" + Employee.EmployeeNameSurname + "/" + Employee.EmployeeNameSurname + "_" + Review.ReviewID + "(ZA_VRABOTEN).docx";
var doc = DocX.Load("templ/templ(ZAVRABOTEN).docx");
doc.ReplaceText("<ime na vraboten>", Employee.EmployeeNameSurname);
doc.ReplaceText("<datum na ragjanje>", Employee.EmployeeBirthDate.ToShortDateString());
doc.ReplaceText("<професија>", Employee.EmployeeProffesion);
doc.ReplaceText("<rab mesto>", Employee.EmployeeWorks);
doc.ReplaceText("<datum pregled>", Review.ReviewDate.ToShortDateString());
Formatting newf = new Formatting();
newf.UnderlineStyle = UnderlineStyle.singleLine;
newf.Bold = true;
newf.Size = 14;
var tip_pregled = "";
switch (Review.ReviewType)
{
case "1":
tip_pregled = "СИСТЕМАТСКИ";
break;
case "2":
tip_pregled = "ПЕРИОДИЧЕН";
break;
case "3":
tip_pregled = "ПЕРИОДИЧЕН";
break;
case "4":
tip_pregled = "ПЕРИОДИЧЕН";
break;
case "5":
tip_pregled = "НАСОЧЕН";
break;
}
doc.ReplaceText(tip_pregled, tip_pregled, false, System.Text.RegularExpressions.RegexOptions.None, newf);
doc.SaveAs(fileName);
}
示例2: CreateDoc
private string CreateDoc( ) {
var fileName = Seged.Seged.CreateFileName(versenyAdatok.VersenysorozatAzonosito, versenyAdatok.Azonosito,
DokumentumTipus.Startlista.BeiroLap);
document = DocX.Create( fileName );
document.MarginBottom = 10;
document.AddHeaders( );
#region Cimbekezdes
var titleFormat = new Formatting {Size = 10D, Position = 1, Spacing = 5, Bold = true};
var header = document.Headers.odd;
var title = header.InsertParagraph();
title.Append( Feliratok.HeadLine.Beirolap);
title.Alignment = Alignment.center;
titleFormat.Size = 10D;
title.AppendLine( Feliratok.Tulajdonos );
title.AppendLine( );
title.Bold( );
titleFormat.Position = 12;
#endregion
VersenyTablazat( );
InduloTablazat( );
EredmenyTablazat( );
AlairasTablazat( );
try { document.Save( ); } catch( System.Exception ) { MessageBox.Show( "A dokumentum meg van nyitva!", "Nevezési lista", MessageBoxButton.OK, MessageBoxImage.Error ); }
return fileName;
}
示例3: Main
public static void Main(string[] args)
{
string pictureFileName = @"..\..\rpg-game.png";
string textFileName = @"..\..\text.txt";
string wordDocument = @"..\..\WordDocument.doc";
var headLineFormat = new Formatting();
headLineFormat.FontFamily = new System.Drawing.FontFamily("Arial Black");
headLineFormat.Size = 18D;
headLineFormat.Position = 12;
var paraFormat = new Formatting();
paraFormat.FontFamily = new System.Drawing.FontFamily("Calibri");
paraFormat.Size = 10D;
// Create the document in memory:
var doc = DocX.Create(wordDocument);
// Insert the now text obejcts;
doc.InsertParagraph(textFileName, false, headLineFormat);
doc.InsertParagraph(wordDocument, false, paraFormat);
// Save to the output directory:
doc.Save();
// Open in Word:
Process.Start("WINWORD.EXE", wordDocument);
}
示例4: Main
static void Main()
{
string fileName = @"C:\Users\Viktor\Desktop\DocXExample.docx";
string headlineText = "Constitution of the United States";
string paraOne = ""
+ "We the People of the United States, in Order to form a more perfect Union, "
+ "establish Justice, insure domestic Tranquility, provide for the common defence, "
+ "promote the general Welfare, and secure the Blessings of Liberty to ourselves "
+ "and our Posterity, do ordain and establish this Constitution for the United "
+ "States of America.";
// A formatting object for our headline:
var headLineFormat = new Formatting();
headLineFormat.FontFamily = new System.Drawing.FontFamily("Arial Black");
headLineFormat.Size = 18D;
headLineFormat.Position = 12;
// A formatting object for our normal paragraph text:
var paraFormat = new Formatting();
paraFormat.FontFamily = new System.Drawing.FontFamily("Calibri");
paraFormat.Size = 10D;
// Create the document in memory:
var doc = DocX.Create(fileName);
// Insert the now text obejcts;
doc.InsertParagraph(headlineText, false, headLineFormat);
doc.InsertParagraph(paraOne, false, paraFormat);
// Save to the output directory:
doc.Save();
// Open in Word:
Process.Start("WINWORD.EXE", fileName);
}
示例5: Change
public override void Change()
{
base.Change();
var doc = DocX.Load(FileName);
string headlineText = "5 фундаментальных правил успеха разработчика ";
StringBuilder paraOne = new StringBuilder();
paraOne.AppendLine("1. Не изобретайте колесо");
paraOne.AppendLine("2. Не тратьте время на код, сосредоточьтесь на скорейшем завершении проекта");
paraOne.AppendLine("3. Обеспечьте техническую поддержку кода ");
paraOne.AppendLine("4. Пользуйтесь правом возврата денег при отсутствии ТП");
paraOne.AppendLine("5. Проверяйте коды и модули на наличие угроз и уязвимостей");
var headLineFormat = new Novacode.Formatting();
headLineFormat.FontFamily = new System.Drawing.FontFamily("Times New Roman");
headLineFormat.Size = 18D;
headLineFormat.Position = 12;
var paraFormat = new Novacode.Formatting();
paraFormat.FontFamily = new System.Drawing.FontFamily("Courier New");
paraFormat.Size = 10D;
doc.InsertParagraph("paragraph 1");
doc.InsertParagraph(headlineText, false, headLineFormat);
doc.InsertParagraph(paraOne.ToString(), false, paraFormat);
doc.Save();
Save();
}
示例6: AddPar
public DocX AddPar(string text=null)
{
Formatting par = new Formatting();
par.Size = 14;
this.document.InsertParagraph(text, false, par).Alignment = Alignment.left;
return this.Document;
}
示例7: Parse
public static Formatting Parse(XElement rPr)
{
Formatting formatting = new Formatting();
// Build up the Formatting object.
foreach (XElement option in rPr.Elements())
{
switch (option.Name.LocalName)
{
case "lang": formatting.Language = new CultureInfo(option.GetAttribute(XName.Get("val", DocX.w.NamespaceName), null) ?? option.GetAttribute(XName.Get("eastAsia", DocX.w.NamespaceName), null) ?? option.GetAttribute(XName.Get("bidi", DocX.w.NamespaceName))); break;
case "spacing": formatting.Spacing = Double.Parse(option.GetAttribute(XName.Get("val", DocX.w.NamespaceName))) / 20.0; break;
case "position": formatting.Position = Int32.Parse(option.GetAttribute(XName.Get("val", DocX.w.NamespaceName))) / 2; break;
case "kern": formatting.Position = Int32.Parse(option.GetAttribute(XName.Get("val", DocX.w.NamespaceName))) / 2; break;
case "w": formatting.PercentageScale = Int32.Parse(option.GetAttribute(XName.Get("val", DocX.w.NamespaceName))); break;
case "rFonts": break;
case "vanish": formatting.hidden = true; break;
case "b": formatting.Bold = true; break;
case "i": formatting.Italic = true; break;
default: break;
}
}
return formatting;
}
示例8: RenderParagraph
private void RenderParagraph(string value, Formatting formatting)
{
if (!String.IsNullOrWhiteSpace(value))
{
_wordDocument.InsertParagraph(value, false, formatting);
}
}
示例9: AddHead
public DocX AddHead(string text)
{
Formatting head=new Formatting();
head.Size=25;
head.Bold = true;
this.document.InsertParagraph(text,false,head).Alignment = Alignment.center;
return this.Document;
}
示例10: CreateHeader
private static void CreateHeader(DocX doc)
{
string headerText = "SoftUni OOP Game Contest";
var headerFormat = new Formatting();
headerFormat.FontFamily = new FontFamily("Tahoma");
headerFormat.Size = 18D;
headerFormat.Position = 12;
var header = doc.InsertParagraph(headerText, false, headerFormat);
header.Alignment = Alignment.center;
}
示例11: InitializeIdeaFormatting
private void InitializeIdeaFormatting()
{
Tag = new Formatting();
Tag.Italic = true;
IdeaText = new Formatting();
IdeaComment = new Formatting();
}
示例12: BoldItalic
public DocX BoldItalic()
{
Formatting par=new Formatting();
par.Bold=true;
par.Size = 14;
this.Document.ReplaceText("role playing game", "role playing game",false,RegexOptions.None,par,null,MatchFormattingOptions.ExactMatch);
this.Document.ReplaceText("grand prize!","grand prize!",false,RegexOptions.None,par,null,MatchFormattingOptions.ExactMatch);
return this.Document;
}
示例13: CreateAndInsertInvoiceTableAfter
private static Table CreateAndInsertInvoiceTableAfter(Table t, ref DocX document)
{
// Grab data from somewhere (Most likely a database)
schooldbEntities DAO = new schooldbEntities();
List<teacher> tlist = (from tt in DAO.teachers select tt).ToList<teacher>();
/*
* The trick to replacing one Table with another,
* is to insert the new Table after the old one,
* and then remove the old one.
*/
Table invoice_table = t.InsertTableAfterSelf(tlist.Count + 1, 4);
invoice_table.Design = TableDesign.LightShadingAccent1;
#region Table title
Formatting table_title = new Formatting();
table_title.Bold = true;
invoice_table.Rows[0].Cells[0].Paragraph.InsertText("Serial No.", false, table_title);
invoice_table.Rows[0].Cells[0].Paragraph.Alignment = Alignment.center;
invoice_table.Rows[0].Cells[1].Paragraph.InsertText("Employee Name", false, table_title);
invoice_table.Rows[0].Cells[1].Paragraph.Alignment = Alignment.center;
invoice_table.Rows[0].Cells[2].Paragraph.InsertText("Account No.", false, table_title);
invoice_table.Rows[0].Cells[2].Paragraph.Alignment = Alignment.center;
invoice_table.Rows[0].Cells[3].Paragraph.InsertText("Salary", false, table_title);
invoice_table.Rows[0].Cells[3].Paragraph.Alignment = Alignment.center;
#endregion
// Loop through the rows in the Table and insert data from the data source.
for (int row = 1; row < tlist.Count; row++)
{
Paragraph cell_paragraph = invoice_table.Rows[row].Cells[0].Paragraph;
cell_paragraph.InsertText(row.ToString(), false);
cell_paragraph = invoice_table.Rows[row].Cells[1].Paragraph;
cell_paragraph.InsertText(tlist[row - 1].TeacherName.ToString(), false);
cell_paragraph = invoice_table.Rows[row].Cells[2].Paragraph;
cell_paragraph.InsertText(tlist[row - 1].Account_Number.ToString(), false);
cell_paragraph = invoice_table.Rows[row].Cells[3].Paragraph;
cell_paragraph.InsertText(tlist[row - 1].BasicSalary.ToString(), false);
}
// Let the tables coloumns expand to fit its contents.
invoice_table.AutoFit = AutoFit.Contents;
// Center the Table
invoice_table.Alignment = Alignment.center;
// Return the invloce table now that it has been created.
return invoice_table;
}
示例14: AddHeader
private void AddHeader( ) {
var titleFormat = new Formatting {Size = 14D, Position = 1, Spacing = 5, Bold = true};
Document.AddHeaders( );
var firstPageHeader = Document.Headers.first;
var title = firstPageHeader.InsertParagraph();
title.Append( Feliratok.HeadLine.NevezesiLista );
title.Alignment = Alignment.center;
titleFormat.Size = 10D;
title.AppendLine( Feliratok.Tulajdonos );
title.AppendLine( );
title.Bold( );
titleFormat.Position = 12;
}
示例15: CreateLandscapePart
public DocX CreateLandscapePart()
{
System.IO.MemoryStream ms2 = new System.IO.MemoryStream();
DocX document2 = DocX.Create(ms2);
document2.PageLayout.Orientation = Novacode.Orientation.Landscape;
var titleStyle = new Formatting();
titleStyle.Size = 12;
titleStyle.Bold = true;
titleStyle.FontFamily = new System.Drawing.FontFamily("Times New Roman");
Paragraph p = document2.InsertParagraph("7. РЕЗУЛТАТИ ОТ ИЗПИТВАНЕ", false, titleStyle);
p.IndentationBefore = 2;
return document2;
}