本文整理汇总了C#中Font.Append方法的典型用法代码示例。如果您正苦于以下问题:C# Font.Append方法的具体用法?C# Font.Append怎么用?C# Font.Append使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Font
的用法示例。
在下文中一共展示了Font.Append方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: CreateFont
public static UInt32Value CreateFont(Stylesheet styleSheet, string fontName, double? fontSize, bool isBold, System.Drawing.Color foreColor)
{
Font font = new Font();
if (!string.IsNullOrEmpty(fontName))
{
FontName name = new FontName()
{
Val = fontName
};
font.Append(name);
}
if (fontSize.HasValue)
{
FontSize size = new FontSize()
{
Val = fontSize.Value
};
font.Append(size);
}
if (isBold == true)
{
Bold bold = new Bold();
font.Append(bold);
}
Color color = new Color()
{
Rgb = new HexBinaryValue()
{
Value =
System.Drawing.ColorTranslator.ToHtml(
System.Drawing.Color.FromArgb(
foreColor.A,
foreColor.R,
foreColor.G,
foreColor.B)).Replace("#", "")
}
};
font.Append(color);
styleSheet.Fonts.Append(font);
UInt32Value result = styleSheet.Fonts.Count;
styleSheet.Fonts.Count++;
return result;
}
示例2: GetFont
static public Font GetFont(this CellTextAttribute cellTextAttribute)
{
Font retFont = new Font();
if(cellTextAttribute.Bold)
{
retFont.Append(new Bold());
}
if(cellTextAttribute.Italic)
{
retFont.Append(new Italic());
}
if(cellTextAttribute.Underliine)
{
retFont.Append(new Underline());
}
return retFont;
}
示例3: Main
static void Main(string[] args)
{
var workbookClosed = new XLWorkbook();
var sheet = workbookClosed.Worksheets.Add("Sheet1");
sheet.Cell(1, 1).Value = 1;
sheet.Cell(2, 1).Value = -1;
workbookClosed.SaveAs("closed.xlsx");
using (SpreadsheetDocument report = SpreadsheetDocument.Open("closed.xlsx", true))
{
Workbook workbook = report.WorkbookPart.Workbook;
WorksheetPart worksheetPart = workbook.WorkbookPart.WorksheetParts.First();
DifferentialFormats differentialFormats = new DifferentialFormats() { Count = (UInt32Value)2U };
DifferentialFormat lessThanFormat = new DifferentialFormat();
Font lessThanFont = new Font();
lessThanFont.Append(new Condense() { Val = false });
lessThanFont.Append(new Extend() { Val = false });
lessThanFont.Append(new Color() { Rgb = "FF9C0006" });
Fill lessThanFill = new Fill();
PatternFill lessThanPatternFill = new PatternFill();
lessThanPatternFill.Append(new BackgroundColor() { Rgb = "FFFFC7CE" });
lessThanFill.Append(lessThanPatternFill);
lessThanFormat.Append(lessThanFont);
lessThanFormat.Append(lessThanFill);
DifferentialFormat greaterThanFormat = new DifferentialFormat();
Font greaterThanFont = new Font();
greaterThanFont.Append(new Condense() { Val = false });
greaterThanFont.Append(new Extend() { Val = false });
greaterThanFont.Append(new Color() { Rgb = "FF006100" });
Fill greatherThanFill = new Fill();
PatternFill greaterThanPatternFill = new PatternFill();
greaterThanPatternFill.Append(new BackgroundColor() { Rgb = "FFC6EFCE" });
greatherThanFill.Append(greaterThanPatternFill);
greaterThanFormat.Append(greaterThanFont);
greaterThanFormat.Append(greatherThanFill);
differentialFormats.Append(lessThanFormat);
differentialFormats.Append(greaterThanFormat);
workbook.WorkbookPart.WorkbookStylesPart.Stylesheet.Append(differentialFormats);
ConditionalFormatting conditionalFormatting = new ConditionalFormatting()
{
SequenceOfReferences = new ListValue<StringValue>() { InnerText = "D2:D10" }
};
ConditionalFormattingRule greaterThanRule = new ConditionalFormattingRule()
{
Type = ConditionalFormatValues.CellIs,
FormatId = (UInt32Value)1U,
Priority = 2,
Operator = ConditionalFormattingOperatorValues.GreaterThan
};
Formula greaterThanFormula = new Formula();
greaterThanFormula.Text = "0";
greaterThanRule.Append(greaterThanFormula);
ConditionalFormattingRule lessThanRule = new ConditionalFormattingRule()
{
Type = ConditionalFormatValues.CellIs,
FormatId = (UInt32Value)0U,
Priority = 1,
Operator = ConditionalFormattingOperatorValues.LessThan
};
Formula lessThanFormula = new Formula();
lessThanFormula.Text = "0";
lessThanRule.Append(lessThanFormula);
conditionalFormatting.Append(greaterThanRule);
conditionalFormatting.Append(lessThanRule);
worksheetPart.Worksheet.PrependChild<ConditionalFormatting>(conditionalFormatting);
report.WorkbookPart.Workbook.Save();
report.Close();
}
}
示例4: GenerateFontTablePart1Content
// Generates content of fontTablePart1.
private void GenerateFontTablePart1Content(FontTablePart fontTablePart1)
{
Fonts fonts1 = new Fonts(){ MCAttributes = new MarkupCompatibilityAttributes(){ Ignorable = "w14 w15" } };
fonts1.AddNamespaceDeclaration("mc", "http://schemas.openxmlformats.org/markup-compatibility/2006");
fonts1.AddNamespaceDeclaration("r", "http://schemas.openxmlformats.org/officeDocument/2006/relationships");
fonts1.AddNamespaceDeclaration("w", "http://schemas.openxmlformats.org/wordprocessingml/2006/main");
fonts1.AddNamespaceDeclaration("w14", "http://schemas.microsoft.com/office/word/2010/wordml");
fonts1.AddNamespaceDeclaration("w15", "http://schemas.microsoft.com/office/word/2010/11/wordml");
Font font1 = new Font(){ Name = "Century" };
Panose1Number panose1Number1 = new Panose1Number(){ Val = "02040604050505020304" };
FontCharSet fontCharSet1 = new FontCharSet(){ Val = "00" };
FontFamily fontFamily1 = new FontFamily(){ Val = FontFamilyValues.Roman };
Pitch pitch1 = new Pitch(){ Val = FontPitchValues.Variable };
FontSignature fontSignature1 = new FontSignature(){ UnicodeSignature0 = "00000287", UnicodeSignature1 = "00000000", UnicodeSignature2 = "00000000", UnicodeSignature3 = "00000000", CodePageSignature0 = "0000009F", CodePageSignature1 = "00000000" };
font1.Append(panose1Number1);
font1.Append(fontCharSet1);
font1.Append(fontFamily1);
font1.Append(pitch1);
font1.Append(fontSignature1);
Font font2 = new Font(){ Name = "MS 明朝" };
AltName altName1 = new AltName(){ Val = "MS Mincho" };
Panose1Number panose1Number2 = new Panose1Number(){ Val = "02020609040205080304" };
FontCharSet fontCharSet2 = new FontCharSet(){ Val = "80" };
FontFamily fontFamily2 = new FontFamily(){ Val = FontFamilyValues.Roman };
Pitch pitch2 = new Pitch(){ Val = FontPitchValues.Fixed };
FontSignature fontSignature2 = new FontSignature(){ UnicodeSignature0 = "E00002FF", UnicodeSignature1 = "6AC7FDFB", UnicodeSignature2 = "00000012", UnicodeSignature3 = "00000000", CodePageSignature0 = "0002009F", CodePageSignature1 = "00000000" };
font2.Append(altName1);
font2.Append(panose1Number2);
font2.Append(fontCharSet2);
font2.Append(fontFamily2);
font2.Append(pitch2);
font2.Append(fontSignature2);
Font font3 = new Font(){ Name = "Times New Roman" };
Panose1Number panose1Number3 = new Panose1Number(){ Val = "02020603050405020304" };
FontCharSet fontCharSet3 = new FontCharSet(){ Val = "00" };
FontFamily fontFamily3 = new FontFamily(){ Val = FontFamilyValues.Roman };
Pitch pitch3 = new Pitch(){ Val = FontPitchValues.Variable };
FontSignature fontSignature3 = new FontSignature(){ UnicodeSignature0 = "E0002AFF", UnicodeSignature1 = "C0007841", UnicodeSignature2 = "00000009", UnicodeSignature3 = "00000000", CodePageSignature0 = "000001FF", CodePageSignature1 = "00000000" };
font3.Append(panose1Number3);
font3.Append(fontCharSet3);
font3.Append(fontFamily3);
font3.Append(pitch3);
font3.Append(fontSignature3);
Font font4 = new Font(){ Name = "MS ゴシック" };
AltName altName2 = new AltName(){ Val = "MS Gothic" };
Panose1Number panose1Number4 = new Panose1Number(){ Val = "020B0609070205080204" };
FontCharSet fontCharSet4 = new FontCharSet(){ Val = "80" };
FontFamily fontFamily4 = new FontFamily(){ Val = FontFamilyValues.Modern };
Pitch pitch4 = new Pitch(){ Val = FontPitchValues.Fixed };
FontSignature fontSignature4 = new FontSignature(){ UnicodeSignature0 = "E00002FF", UnicodeSignature1 = "6AC7FDFB", UnicodeSignature2 = "00000012", UnicodeSignature3 = "00000000", CodePageSignature0 = "0002009F", CodePageSignature1 = "00000000" };
font4.Append(altName2);
font4.Append(panose1Number4);
font4.Append(fontCharSet4);
font4.Append(fontFamily4);
font4.Append(pitch4);
font4.Append(fontSignature4);
Font font5 = new Font(){ Name = "Arial" };
Panose1Number panose1Number5 = new Panose1Number(){ Val = "020B0604020202020204" };
FontCharSet fontCharSet5 = new FontCharSet(){ Val = "00" };
FontFamily fontFamily5 = new FontFamily(){ Val = FontFamilyValues.Swiss };
Pitch pitch5 = new Pitch(){ Val = FontPitchValues.Variable };
FontSignature fontSignature5 = new FontSignature(){ UnicodeSignature0 = "E0002AFF", UnicodeSignature1 = "C0007843", UnicodeSignature2 = "00000009", UnicodeSignature3 = "00000000", CodePageSignature0 = "000001FF", CodePageSignature1 = "00000000" };
font5.Append(panose1Number5);
font5.Append(fontCharSet5);
font5.Append(fontFamily5);
font5.Append(pitch5);
font5.Append(fontSignature5);
fonts1.Append(font1);
fonts1.Append(font2);
fonts1.Append(font3);
fonts1.Append(font4);
fonts1.Append(font5);
fontTablePart1.Fonts = fonts1;
}
示例5: GenerateWorkbookStylesPart1Content
// Generates content of workbookStylesPart1.
private void GenerateWorkbookStylesPart1Content(WorkbookStylesPart workbookStylesPart1)
{
Stylesheet stylesheet1 = new Stylesheet();
NumberingFormats numberingFormats1 = new NumberingFormats() { Count = (UInt32Value)2U };
NumberingFormat numberingFormat1 = new NumberingFormat() { NumberFormatId = (UInt32Value)44U, FormatCode = "_ \"$\"\\ * #,##0.00_ ;_ \"$\"\\ * \\-#,##0.00_ ;_ \"$\"\\ * \"-\"??_ ;_ @_ " };
NumberingFormat numberingFormat2 = new NumberingFormat() { NumberFormatId = (UInt32Value)165U, FormatCode = "mmmm/yyyy" };
numberingFormats1.Append(numberingFormat1);
numberingFormats1.Append(numberingFormat2);
Fonts fonts1 = new Fonts() { Count = (UInt32Value)10U };
Font font1 = new Font();
FontSize fontSize1 = new FontSize() { Val = 10D };
FontName fontName1 = new FontName() { Val = "Arial" };
font1.Append(fontSize1);
font1.Append(fontName1);
Font font2 = new Font();
FontSize fontSize2 = new FontSize() { Val = 10D };
FontName fontName2 = new FontName() { Val = "Arial" };
font2.Append(fontSize2);
font2.Append(fontName2);
Font font3 = new Font();
Bold bold1 = new Bold();
FontSize fontSize3 = new FontSize() { Val = 10D };
FontName fontName3 = new FontName() { Val = "Arial" };
FontFamilyNumbering fontFamilyNumbering1 = new FontFamilyNumbering() { Val = 2 };
font3.Append(bold1);
font3.Append(fontSize3);
font3.Append(fontName3);
font3.Append(fontFamilyNumbering1);
Font font4 = new Font();
Bold bold2 = new Bold();
FontSize fontSize4 = new FontSize() { Val = 10D };
Color color1 = new Color() { Indexed = (UInt32Value)9U };
FontName fontName4 = new FontName() { Val = "Arial" };
FontFamilyNumbering fontFamilyNumbering2 = new FontFamilyNumbering() { Val = 2 };
font4.Append(bold2);
font4.Append(fontSize4);
font4.Append(color1);
font4.Append(fontName4);
font4.Append(fontFamilyNumbering2);
Font font5 = new Font();
FontSize fontSize5 = new FontSize() { Val = 8D };
FontName fontName5 = new FontName() { Val = "Arial" };
FontFamilyNumbering fontFamilyNumbering3 = new FontFamilyNumbering() { Val = 2 };
font5.Append(fontSize5);
font5.Append(fontName5);
font5.Append(fontFamilyNumbering3);
Font font6 = new Font();
Bold bold3 = new Bold();
FontSize fontSize6 = new FontSize() { Val = 8D };
FontName fontName6 = new FontName() { Val = "Arial" };
FontFamilyNumbering fontFamilyNumbering4 = new FontFamilyNumbering() { Val = 2 };
font6.Append(bold3);
font6.Append(fontSize6);
font6.Append(fontName6);
font6.Append(fontFamilyNumbering4);
Font font7 = new Font();
Bold bold4 = new Bold();
FontSize fontSize7 = new FontSize() { Val = 15D };
FontName fontName7 = new FontName() { Val = "Arial" };
FontFamilyNumbering fontFamilyNumbering5 = new FontFamilyNumbering() { Val = 2 };
font7.Append(bold4);
font7.Append(fontSize7);
font7.Append(fontName7);
font7.Append(fontFamilyNumbering5);
Font font8 = new Font();
FontSize fontSize8 = new FontSize() { Val = 10D };
FontName fontName8 = new FontName() { Val = "Arial" };
FontFamilyNumbering fontFamilyNumbering6 = new FontFamilyNumbering() { Val = 2 };
font8.Append(fontSize8);
font8.Append(fontName8);
font8.Append(fontFamilyNumbering6);
Font font9 = new Font();
FontSize fontSize9 = new FontSize() { Val = 8D };
FontName fontName9 = new FontName() { Val = "Arial" };
font9.Append(fontSize9);
font9.Append(fontName9);
Font font10 = new Font();
//.........这里部分代码省略.........
示例6: AddConditionalFormatting
private void AddConditionalFormatting()
{
//use openxml directly to apply conditional formatting.
using (SpreadsheetDocument report = SpreadsheetDocument.Open(fileName, true))
{
Workbook workbook = report.WorkbookPart.Workbook;
WorksheetPart worksheetPart = workbook.WorkbookPart.WorksheetParts.First();
DifferentialFormats differentialFormats = new DifferentialFormats() { Count = (UInt32Value)2U };
DifferentialFormat lessThanFormat = new DifferentialFormat();
Font lessThanFont = new Font();
lessThanFont.Append(new Condense() { Val = false });
lessThanFont.Append(new Extend() { Val = false });
lessThanFont.Append(new Color() { Rgb = "FF9C0006" });
Fill lessThanFill = new Fill();
PatternFill lessThanPatternFill = new PatternFill();
lessThanPatternFill.Append(new BackgroundColor() { Rgb = "FFFFC7CE" });
lessThanFill.Append(lessThanPatternFill);
lessThanFormat.Append(lessThanFont);
lessThanFormat.Append(lessThanFill);
DifferentialFormat greaterThanFormat = new DifferentialFormat();
Font greaterThanFont = new Font();
greaterThanFont.Append(new Condense() { Val = false });
greaterThanFont.Append(new Extend() { Val = false });
greaterThanFont.Append(new Color() { Rgb = "FF006100" });
Fill greatherThanFill = new Fill();
PatternFill greaterThanPatternFill = new PatternFill();
greaterThanPatternFill.Append(new BackgroundColor() { Rgb = "FFC6EFCE" });
greatherThanFill.Append(greaterThanPatternFill);
greaterThanFormat.Append(greaterThanFont);
greaterThanFormat.Append(greatherThanFill);
differentialFormats.Append(lessThanFormat);
differentialFormats.Append(greaterThanFormat);
workbook.WorkbookPart.WorkbookStylesPart.Stylesheet.Append(differentialFormats);
ConditionalFormatting conditionalFormatting = new ConditionalFormatting() {
SequenceOfReferences = new ListValue<StringValue>() { InnerText = "D2:D10" }
};
ConditionalFormattingRule greaterThanRule = new ConditionalFormattingRule()
{
Type = ConditionalFormatValues.CellIs,
FormatId = (UInt32Value)1U,
Priority = 2,
Operator = ConditionalFormattingOperatorValues.GreaterThan
};
Formula greaterThanFormula = new Formula();
greaterThanFormula.Text = "0";
greaterThanRule.Append(greaterThanFormula);
ConditionalFormattingRule lessThanRule = new ConditionalFormattingRule()
{
Type = ConditionalFormatValues.CellIs,
FormatId = (UInt32Value)0U,
Priority = 1,
Operator = ConditionalFormattingOperatorValues.LessThan
};
Formula lessThanFormula = new Formula();
lessThanFormula.Text = "0";
lessThanRule.Append(lessThanFormula);
conditionalFormatting.Append(greaterThanRule);
conditionalFormatting.Append(lessThanRule);
worksheetPart.Worksheet.Append(conditionalFormatting);
report.WorkbookPart.Workbook.Save();
report.Close();
}
}
示例7: GenerateWorkbookStylesPart1Content
// Generates content of workbookStylesPart1.
private void GenerateWorkbookStylesPart1Content(WorkbookStylesPart workbookStylesPart1)
{
Stylesheet stylesheet1 = new Stylesheet();
Fonts fonts1 = new Fonts() { Count = (UInt32Value)1U, KnownFonts = true };
Font font1 = new Font();
FontSize fontSize1 = new FontSize() { Val = 11D };
Color color1 = new Color() { Theme = (UInt32Value)1U };
FontName fontName1 = new FontName() { Val = "Calibri" };
FontFamilyNumbering fontFamilyNumbering1 = new FontFamilyNumbering() { Val = 2 };
FontScheme fontScheme1 = new FontScheme() { Val = FontSchemeValues.Minor };
font1.Append(fontSize1);
font1.Append(color1);
font1.Append(fontName1);
font1.Append(fontFamilyNumbering1);
font1.Append(fontScheme1);
fonts1.Append(font1);
Fills fills1 = new Fills() { Count = (UInt32Value)2U };
Fill fill1 = new Fill();
PatternFill patternFill1 = new PatternFill() { PatternType = PatternValues.None };
fill1.Append(patternFill1);
Fill fill2 = new Fill();
PatternFill patternFill2 = new PatternFill() { PatternType = PatternValues.Gray125 };
fill2.Append(patternFill2);
fills1.Append(fill1);
fills1.Append(fill2);
Borders borders1 = new Borders() { Count = (UInt32Value)1U };
Border border1 = new Border();
LeftBorder leftBorder1 = new LeftBorder();
RightBorder rightBorder1 = new RightBorder();
TopBorder topBorder1 = new TopBorder();
BottomBorder bottomBorder1 = new BottomBorder();
DiagonalBorder diagonalBorder1 = new DiagonalBorder();
border1.Append(leftBorder1);
border1.Append(rightBorder1);
border1.Append(topBorder1);
border1.Append(bottomBorder1);
border1.Append(diagonalBorder1);
borders1.Append(border1);
CellStyleFormats cellStyleFormats1 = new CellStyleFormats() { Count = (UInt32Value)1U };
CellFormat cellFormat1 = new CellFormat() { NumberFormatId = (UInt32Value)0U, FontId = (UInt32Value)0U, FillId = (UInt32Value)0U, BorderId = (UInt32Value)0U };
cellStyleFormats1.Append(cellFormat1);
CellFormats cellFormats1 = new CellFormats() { Count = (UInt32Value)4U };
CellFormat cellFormat2 = new CellFormat() { NumberFormatId = (UInt32Value)0U, FontId = (UInt32Value)0U, FillId = (UInt32Value)0U, BorderId = (UInt32Value)0U, FormatId = (UInt32Value)0U };
CellFormat cellFormat3 = new CellFormat() { NumberFormatId = (UInt32Value)0U, FontId = (UInt32Value)0U, FillId = (UInt32Value)0U, BorderId = (UInt32Value)0U, FormatId = (UInt32Value)0U, ApplyNumberFormat = true };
CellFormat cellFormat4 = new CellFormat() { NumberFormatId = (UInt32Value)0U, FontId = (UInt32Value)0U, FillId = (UInt32Value)0U, BorderId = (UInt32Value)0U, FormatId = (UInt32Value)0U, PivotButton = true };
CellFormat cellFormat5 = new CellFormat() { NumberFormatId = (UInt32Value)0U, FontId = (UInt32Value)0U, FillId = (UInt32Value)0U, BorderId = (UInt32Value)0U, FormatId = (UInt32Value)0U, ApplyAlignment = true };
cellFormats1.Append(cellFormat2);
cellFormats1.Append(cellFormat3);
cellFormats1.Append(cellFormat4);
cellFormats1.Append(cellFormat5);
CellStyles cellStyles1 = new CellStyles() { Count = (UInt32Value)1U };
CellStyle cellStyle1 = new CellStyle() { Name = "Normal", FormatId = (UInt32Value)0U, BuiltinId = (UInt32Value)0U };
cellStyles1.Append(cellStyle1);
DifferentialFormats differentialFormats1 = new DifferentialFormats() { Count = (UInt32Value)0U };
stylesheet1.Append(fonts1);
stylesheet1.Append(fills1);
stylesheet1.Append(borders1);
stylesheet1.Append(cellStyleFormats1);
stylesheet1.Append(cellFormats1);
stylesheet1.Append(cellStyles1);
stylesheet1.Append(differentialFormats1);
workbookStylesPart1.Stylesheet = stylesheet1;
}
示例8: GenerateFontTablePart1Content
// Generates content of fontTablePart1.
private void GenerateFontTablePart1Content(FontTablePart fontTablePart1)
{
Fonts fonts1 = new Fonts() { MCAttributes = new MarkupCompatibilityAttributes() { Ignorable = "w14 w15 w16se" } };
fonts1.AddNamespaceDeclaration("mc", "http://schemas.openxmlformats.org/markup-compatibility/2006");
fonts1.AddNamespaceDeclaration("r", "http://schemas.openxmlformats.org/officeDocument/2006/relationships");
fonts1.AddNamespaceDeclaration("w", "http://schemas.openxmlformats.org/wordprocessingml/2006/main");
fonts1.AddNamespaceDeclaration("w14", "http://schemas.microsoft.com/office/word/2010/wordml");
fonts1.AddNamespaceDeclaration("w15", "http://schemas.microsoft.com/office/word/2012/wordml");
fonts1.AddNamespaceDeclaration("w16se", "http://schemas.microsoft.com/office/word/2015/wordml/symex");
Font font1 = new Font() { Name = "Symbol" };
Panose1Number panose1Number1 = new Panose1Number() { Val = "05050102010706020507" };
FontCharSet fontCharSet1 = new FontCharSet() { Val = "02" };
FontFamily fontFamily1 = new FontFamily() { Val = FontFamilyValues.Roman };
Pitch pitch1 = new Pitch() { Val = FontPitchValues.Variable };
FontSignature fontSignature1 = new FontSignature() { UnicodeSignature0 = "00000000", UnicodeSignature1 = "10000000", UnicodeSignature2 = "00000000", UnicodeSignature3 = "00000000", CodePageSignature0 = "80000000", CodePageSignature1 = "00000000" };
font1.Append(panose1Number1);
font1.Append(fontCharSet1);
font1.Append(fontFamily1);
font1.Append(pitch1);
font1.Append(fontSignature1);
Font font2 = new Font() { Name = "Times New Roman" };
Panose1Number panose1Number2 = new Panose1Number() { Val = "02020603050405020304" };
FontCharSet fontCharSet2 = new FontCharSet() { Val = "00" };
FontFamily fontFamily2 = new FontFamily() { Val = FontFamilyValues.Roman };
Pitch pitch2 = new Pitch() { Val = FontPitchValues.Variable };
FontSignature fontSignature2 = new FontSignature() { UnicodeSignature0 = "E0002EFF", UnicodeSignature1 = "C000784B", UnicodeSignature2 = "00000009", UnicodeSignature3 = "00000000", CodePageSignature0 = "000001FF", CodePageSignature1 = "00000000" };
font2.Append(panose1Number2);
font2.Append(fontCharSet2);
font2.Append(fontFamily2);
font2.Append(pitch2);
font2.Append(fontSignature2);
Font font3 = new Font() { Name = "Courier New" };
Panose1Number panose1Number3 = new Panose1Number() { Val = "02070309020205020404" };
FontCharSet fontCharSet3 = new FontCharSet() { Val = "00" };
FontFamily fontFamily3 = new FontFamily() { Val = FontFamilyValues.Modern };
Pitch pitch3 = new Pitch() { Val = FontPitchValues.Fixed };
FontSignature fontSignature3 = new FontSignature() { UnicodeSignature0 = "E0002EFF", UnicodeSignature1 = "C0007843", UnicodeSignature2 = "00000009", UnicodeSignature3 = "00000000", CodePageSignature0 = "000001FF", CodePageSignature1 = "00000000" };
font3.Append(panose1Number3);
font3.Append(fontCharSet3);
font3.Append(fontFamily3);
font3.Append(pitch3);
font3.Append(fontSignature3);
Font font4 = new Font() { Name = "Wingdings" };
Panose1Number panose1Number4 = new Panose1Number() { Val = "05000000000000000000" };
FontCharSet fontCharSet4 = new FontCharSet() { Val = "02" };
FontFamily fontFamily4 = new FontFamily() { Val = FontFamilyValues.Auto };
Pitch pitch4 = new Pitch() { Val = FontPitchValues.Variable };
FontSignature fontSignature4 = new FontSignature() { UnicodeSignature0 = "00000000", UnicodeSignature1 = "10000000", UnicodeSignature2 = "00000000", UnicodeSignature3 = "00000000", CodePageSignature0 = "80000000", CodePageSignature1 = "00000000" };
font4.Append(panose1Number4);
font4.Append(fontCharSet4);
font4.Append(fontFamily4);
font4.Append(pitch4);
font4.Append(fontSignature4);
Font font5 = new Font() { Name = "Calibri" };
Panose1Number panose1Number5 = new Panose1Number() { Val = "020F0502020204030204" };
FontCharSet fontCharSet5 = new FontCharSet() { Val = "00" };
FontFamily fontFamily5 = new FontFamily() { Val = FontFamilyValues.Swiss };
Pitch pitch5 = new Pitch() { Val = FontPitchValues.Variable };
FontSignature fontSignature5 = new FontSignature() { UnicodeSignature0 = "E0002AFF", UnicodeSignature1 = "C000247B", UnicodeSignature2 = "00000009", UnicodeSignature3 = "00000000", CodePageSignature0 = "000001FF", CodePageSignature1 = "00000000" };
font5.Append(panose1Number5);
font5.Append(fontCharSet5);
font5.Append(fontFamily5);
font5.Append(pitch5);
font5.Append(fontSignature5);
Font font6 = new Font() { Name = "Arial" };
Panose1Number panose1Number6 = new Panose1Number() { Val = "020B0604020202020204" };
FontCharSet fontCharSet6 = new FontCharSet() { Val = "00" };
FontFamily fontFamily6 = new FontFamily() { Val = FontFamilyValues.Swiss };
Pitch pitch6 = new Pitch() { Val = FontPitchValues.Variable };
FontSignature fontSignature6 = new FontSignature() { UnicodeSignature0 = "E0002EFF", UnicodeSignature1 = "C0007843", UnicodeSignature2 = "00000009", UnicodeSignature3 = "00000000", CodePageSignature0 = "000001FF", CodePageSignature1 = "00000000" };
font6.Append(panose1Number6);
font6.Append(fontCharSet6);
font6.Append(fontFamily6);
font6.Append(pitch6);
font6.Append(fontSignature6);
Font font7 = new Font() { Name = "Cambria" };
Panose1Number panose1Number7 = new Panose1Number() { Val = "02040503050406030204" };
FontCharSet fontCharSet7 = new FontCharSet() { Val = "00" };
FontFamily fontFamily7 = new FontFamily() { Val = FontFamilyValues.Roman };
Pitch pitch7 = new Pitch() { Val = FontPitchValues.Variable };
FontSignature fontSignature7 = new FontSignature() { UnicodeSignature0 = "E00002FF", UnicodeSignature1 = "400004FF", UnicodeSignature2 = "00000000", UnicodeSignature3 = "00000000", CodePageSignature0 = "0000019F", CodePageSignature1 = "00000000" };
font7.Append(panose1Number7);
font7.Append(fontCharSet7);
font7.Append(fontFamily7);
font7.Append(pitch7);
//.........这里部分代码省略.........
示例9: GenerateStylesheet
// Creates an Stylesheet instance and adds its children.
public static Stylesheet GenerateStylesheet()
{
var stylesheet1 = new Stylesheet {MCAttributes = new MarkupCompatibilityAttributes {Ignorable = "x14ac"}};
stylesheet1.AddNamespaceDeclaration("mc", "http://schemas.openxmlformats.org/markup-compatibility/2006");
stylesheet1.AddNamespaceDeclaration("x14ac", "http://schemas.microsoft.com/office/spreadsheetml/2009/9/ac");
var fonts1 = new Fonts {Count = 7U, KnownFonts = true};
var font1 = new Font();
var fontSize1 = new FontSize {Val = 11D};
var color1 = new Color {Theme = 1U};
var fontName1 = new FontName {Val = "Calibri"};
var fontFamilyNumbering1 = new FontFamilyNumbering {Val = 2};
var fontCharSet1 = new FontCharSet {Val = 204};
var fontScheme1 = new FontScheme {Val = FontSchemeValues.Minor};
font1.Append(fontSize1);
font1.Append(color1);
font1.Append(fontName1);
font1.Append(fontFamilyNumbering1);
font1.Append(fontCharSet1);
font1.Append(fontScheme1);
var font2 = new Font();
var bold1 = new Bold();
var fontSize2 = new FontSize {Val = 11D};
var color2 = new Color {Theme = 1U};
var fontName2 = new FontName {Val = "Calibri"};
var fontFamilyNumbering2 = new FontFamilyNumbering {Val = 2};
var fontCharSet2 = new FontCharSet {Val = 204};
var fontScheme2 = new FontScheme {Val = FontSchemeValues.Minor};
font2.Append(bold1);
font2.Append(fontSize2);
font2.Append(color2);
font2.Append(fontName2);
font2.Append(fontFamilyNumbering2);
font2.Append(fontCharSet2);
font2.Append(fontScheme2);
var font3 = new Font();
var bold2 = new Bold();
var italic1 = new Italic();
var fontSize3 = new FontSize {Val = 11D};
var color3 = new Color {Theme = 1U};
var fontName3 = new FontName {Val = "Calibri"};
var fontFamilyNumbering3 = new FontFamilyNumbering {Val = 2};
var fontCharSet3 = new FontCharSet {Val = 204};
var fontScheme3 = new FontScheme {Val = FontSchemeValues.Minor};
font3.Append(bold2);
font3.Append(italic1);
font3.Append(fontSize3);
font3.Append(color3);
font3.Append(fontName3);
font3.Append(fontFamilyNumbering3);
font3.Append(fontCharSet3);
font3.Append(fontScheme3);
var font4 = new Font();
var bold3 = new Bold();
var fontSize4 = new FontSize {Val = 18D};
var color4 = new Color {Theme = 1U};
var fontName4 = new FontName {Val = "Calibri"};
var fontFamilyNumbering4 = new FontFamilyNumbering {Val = 2};
var fontCharSet4 = new FontCharSet {Val = 204};
var fontScheme4 = new FontScheme {Val = FontSchemeValues.Minor};
font4.Append(bold3);
font4.Append(fontSize4);
font4.Append(color4);
font4.Append(fontName4);
font4.Append(fontFamilyNumbering4);
font4.Append(fontCharSet4);
font4.Append(fontScheme4);
var font5 = new Font();
var bold4 = new Bold();
var fontSize5 = new FontSize {Val = 11D};
var fontName5 = new FontName {Val = "Calibri"};
var fontFamilyNumbering5 = new FontFamilyNumbering {Val = 2};
var fontCharSet5 = new FontCharSet {Val = 204};
var fontScheme5 = new FontScheme {Val = FontSchemeValues.Minor};
font5.Append(bold4);
font5.Append(fontSize5);
font5.Append(fontName5);
font5.Append(fontFamilyNumbering5);
font5.Append(fontCharSet5);
font5.Append(fontScheme5);
var font6 = new Font();
var fontSize6 = new FontSize {Val = 11D};
var fontName6 = new FontName {Val = "Calibri"};
var fontFamilyNumbering6 = new FontFamilyNumbering {Val = 2};
var fontCharSet6 = new FontCharSet {Val = 204};
var fontScheme6 = new FontScheme {Val = FontSchemeValues.Minor};
font6.Append(fontSize6);
//.........这里部分代码省略.........
示例10: GenerateWorkbookStylesPart1Content
// Generates content of workbookStylesPart1.
private void GenerateWorkbookStylesPart1Content(WorkbookStylesPart workbookStylesPart1)
{
Stylesheet stylesheet1 = new Stylesheet() { MCAttributes = new MarkupCompatibilityAttributes() { Ignorable = "x14ac" } };
stylesheet1.AddNamespaceDeclaration("mc", "http://schemas.openxmlformats.org/markup-compatibility/2006");
stylesheet1.AddNamespaceDeclaration("x14ac", "http://schemas.microsoft.com/office/spreadsheetml/2009/9/ac");
Fonts fonts1 = new Fonts() { Count = (UInt32Value)1U, KnownFonts = true };
Font font1 = new Font();
FontSize fontSize1 = new FontSize() { Val = 11D };
Color color1 = new Color() { Theme = (UInt32Value)1U };
FontName fontName1 = new FontName() { Val = "Calibri" };
FontFamilyNumbering fontFamilyNumbering1 = new FontFamilyNumbering() { Val = 2 };
FontScheme fontScheme1 = new FontScheme() { Val = FontSchemeValues.Minor };
font1.Append(fontSize1);
font1.Append(color1);
font1.Append(fontName1);
font1.Append(fontFamilyNumbering1);
font1.Append(fontScheme1);
fonts1.Append(font1);
Fills fills1 = new Fills() { Count = (UInt32Value)2U };
Fill fill1 = new Fill();
PatternFill patternFill1 = new PatternFill() { PatternType = PatternValues.None };
fill1.Append(patternFill1);
Fill fill2 = new Fill();
PatternFill patternFill2 = new PatternFill() { PatternType = PatternValues.Gray125 };
fill2.Append(patternFill2);
fills1.Append(fill1);
fills1.Append(fill2);
Borders borders1 = new Borders() { Count = (UInt32Value)1U };
Border border1 = new Border();
LeftBorder leftBorder1 = new LeftBorder();
RightBorder rightBorder1 = new RightBorder();
TopBorder topBorder1 = new TopBorder();
BottomBorder bottomBorder1 = new BottomBorder();
DiagonalBorder diagonalBorder1 = new DiagonalBorder();
border1.Append(leftBorder1);
border1.Append(rightBorder1);
border1.Append(topBorder1);
border1.Append(bottomBorder1);
border1.Append(diagonalBorder1);
borders1.Append(border1);
CellStyleFormats cellStyleFormats1 = new CellStyleFormats() { Count = (UInt32Value)1U };
CellFormat cellFormat1 = new CellFormat() { NumberFormatId = (UInt32Value)0U, FontId = (UInt32Value)0U, FillId = (UInt32Value)0U, BorderId = (UInt32Value)0U };
cellStyleFormats1.Append(cellFormat1);
CellFormats cellFormats1 = new CellFormats() { Count = (UInt32Value)1U };
CellFormat cellFormat2 = new CellFormat() { NumberFormatId = (UInt32Value)0U, FontId = (UInt32Value)0U, FillId = (UInt32Value)0U, BorderId = (UInt32Value)0U, FormatId = (UInt32Value)0U };
cellFormats1.Append(cellFormat2);
CellStyles cellStyles1 = new CellStyles() { Count = (UInt32Value)1U };
CellStyle cellStyle1 = new CellStyle() { Name = "Normal", FormatId = (UInt32Value)0U, BuiltinId = (UInt32Value)0U };
cellStyles1.Append(cellStyle1);
DifferentialFormats differentialFormats1 = new DifferentialFormats() { Count = (UInt32Value)0U };
TableStyles tableStyles1 = new TableStyles() { Count = (UInt32Value)0U, DefaultTableStyle = "TableStyleMedium2", DefaultPivotStyle = "PivotStyleLight16" };
stylesheet1.Append(fonts1);
stylesheet1.Append(fills1);
stylesheet1.Append(borders1);
stylesheet1.Append(cellStyleFormats1);
stylesheet1.Append(cellFormats1);
stylesheet1.Append(cellStyles1);
stylesheet1.Append(differentialFormats1);
stylesheet1.Append(tableStyles1);
workbookStylesPart1.Stylesheet = stylesheet1;
}
示例11: GenerateWorkbookStylesPart1Content
// Generates content of workbookStylesPart1.
private void GenerateWorkbookStylesPart1Content(WorkbookStylesPart workbookStylesPart1)
{
Stylesheet stylesheet1 = new Stylesheet() { MCAttributes = new MarkupCompatibilityAttributes() { Ignorable = "x14ac" } };
stylesheet1.AddNamespaceDeclaration("mc", "http://schemas.openxmlformats.org/markup-compatibility/2006");
stylesheet1.AddNamespaceDeclaration("x14ac", "http://schemas.microsoft.com/office/spreadsheetml/2009/9/ac");
Fonts fonts1 = new Fonts() { Count = (UInt32Value)5U, KnownFonts = true };
Font font1 = new Font();
FontSize fontSize3 = new FontSize() { Val = 11D };
Color color3 = new Color() { Theme = (UInt32Value)1U };
FontName fontName1 = new FontName() { Val = "Calibri" };
FontFamilyNumbering fontFamilyNumbering1 = new FontFamilyNumbering() { Val = 2 };
FontScheme fontScheme2 = new FontScheme() { Val = FontSchemeValues.Minor };
font1.Append(fontSize3);
font1.Append(color3);
font1.Append(fontName1);
font1.Append(fontFamilyNumbering1);
font1.Append(fontScheme2);
Font font2 = new Font();
Bold bold2 = new Bold();
Underline underline1 = new Underline();
FontSize fontSize4 = new FontSize() { Val = 11D };
Color color4 = new Color() { Rgb = "FFFF0000" };
FontName fontName2 = new FontName() { Val = "Calibri" };
FontFamilyNumbering fontFamilyNumbering2 = new FontFamilyNumbering() { Val = 2 };
FontScheme fontScheme3 = new FontScheme() { Val = FontSchemeValues.Minor };
font2.Append(bold2);
font2.Append(underline1);
font2.Append(fontSize4);
font2.Append(color4);
font2.Append(fontName2);
font2.Append(fontFamilyNumbering2);
font2.Append(fontScheme3);
Font font3 = new Font();
Underline underline2 = new Underline();
FontSize fontSize5 = new FontSize() { Val = 11D };
Color color5 = new Color() { Theme = (UInt32Value)10U };
FontName fontName3 = new FontName() { Val = "Calibri" };
FontFamilyNumbering fontFamilyNumbering3 = new FontFamilyNumbering() { Val = 2 };
FontScheme fontScheme4 = new FontScheme() { Val = FontSchemeValues.Minor };
font3.Append(underline2);
font3.Append(fontSize5);
font3.Append(color5);
font3.Append(fontName3);
font3.Append(fontFamilyNumbering3);
font3.Append(fontScheme4);
Font font4 = new Font();
FontSize fontSize6 = new FontSize() { Val = 9D };
Color color6 = new Color() { Indexed = (UInt32Value)81U };
FontName fontName4 = new FontName() { Val = "Tahoma" };
FontCharSet fontCharSet1 = new FontCharSet() { Val = 1 };
font4.Append(fontSize6);
font4.Append(color6);
font4.Append(fontName4);
font4.Append(fontCharSet1);
Font font5 = new Font();
Bold bold3 = new Bold();
FontSize fontSize7 = new FontSize() { Val = 9D };
Color color7 = new Color() { Indexed = (UInt32Value)81U };
FontName fontName5 = new FontName() { Val = "Tahoma" };
FontCharSet fontCharSet2 = new FontCharSet() { Val = 1 };
font5.Append(bold3);
font5.Append(fontSize7);
font5.Append(color7);
font5.Append(fontName5);
font5.Append(fontCharSet2);
fonts1.Append(font1);
fonts1.Append(font2);
fonts1.Append(font3);
fonts1.Append(font4);
fonts1.Append(font5);
Fills fills1 = new Fills() { Count = (UInt32Value)2U };
Fill fill1 = new Fill();
PatternFill patternFill1 = new PatternFill() { PatternType = PatternValues.None };
fill1.Append(patternFill1);
Fill fill2 = new Fill();
PatternFill patternFill2 = new PatternFill() { PatternType = PatternValues.Gray125 };
fill2.Append(patternFill2);
fills1.Append(fill1);
fills1.Append(fill2);
Borders borders1 = new Borders() { Count = (UInt32Value)1U };
//.........这里部分代码省略.........
示例12: GenerateWorkbookStylesPart1Content
// Generates content of workbookStylesPart1.
private void GenerateWorkbookStylesPart1Content(WorkbookStylesPart workbookStylesPart1)
{
Stylesheet stylesheet1 = new Stylesheet(){ MCAttributes = new MarkupCompatibilityAttributes(){ Ignorable = "x14ac" } };
stylesheet1.AddNamespaceDeclaration("mc", "http://schemas.openxmlformats.org/markup-compatibility/2006");
stylesheet1.AddNamespaceDeclaration("x14ac", "http://schemas.microsoft.com/office/spreadsheetml/2009/9/ac");
NumberingFormats numberingFormats1 = new NumberingFormats(){ Count = (UInt32Value)1U };
NumberingFormat numberingFormat11 = new NumberingFormat(){ NumberFormatId = (UInt32Value)164U, FormatCode = "\"¥\"#,##0" };
numberingFormats1.Append(numberingFormat11);
Fonts fonts1 = new Fonts(){ Count = (UInt32Value)2U };
Font font1 = new Font();
FontSize fontSize1 = new FontSize(){ Val = 11D };
Color color1 = new Color(){ Theme = (UInt32Value)1U };
FontName fontName1 = new FontName(){ Val = "Calibri" };
FontFamilyNumbering fontFamilyNumbering1 = new FontFamilyNumbering(){ Val = 2 };
FontScheme fontScheme1 = new FontScheme(){ Val = FontSchemeValues.Minor };
font1.Append(fontSize1);
font1.Append(color1);
font1.Append(fontName1);
font1.Append(fontFamilyNumbering1);
font1.Append(fontScheme1);
Font font2 = new Font();
FontSize fontSize2 = new FontSize(){ Val = 6D };
FontName fontName2 = new FontName(){ Val = "Calibri" };
FontFamilyNumbering fontFamilyNumbering2 = new FontFamilyNumbering(){ Val = 3 };
FontCharSet fontCharSet1 = new FontCharSet(){ Val = 128 };
FontScheme fontScheme2 = new FontScheme(){ Val = FontSchemeValues.Minor };
font2.Append(fontSize2);
font2.Append(fontName2);
font2.Append(fontFamilyNumbering2);
font2.Append(fontCharSet1);
font2.Append(fontScheme2);
fonts1.Append(font1);
fonts1.Append(font2);
Fills fills1 = new Fills(){ Count = (UInt32Value)2U };
Fill fill1 = new Fill();
PatternFill patternFill1 = new PatternFill(){ PatternType = PatternValues.None };
fill1.Append(patternFill1);
Fill fill2 = new Fill();
PatternFill patternFill2 = new PatternFill(){ PatternType = PatternValues.Gray125 };
fill2.Append(patternFill2);
fills1.Append(fill1);
fills1.Append(fill2);
Borders borders1 = new Borders(){ Count = (UInt32Value)1U };
Border border1 = new Border();
LeftBorder leftBorder1 = new LeftBorder();
RightBorder rightBorder1 = new RightBorder();
TopBorder topBorder1 = new TopBorder();
BottomBorder bottomBorder1 = new BottomBorder();
DiagonalBorder diagonalBorder1 = new DiagonalBorder();
border1.Append(leftBorder1);
border1.Append(rightBorder1);
border1.Append(topBorder1);
border1.Append(bottomBorder1);
border1.Append(diagonalBorder1);
borders1.Append(border1);
CellStyleFormats cellStyleFormats1 = new CellStyleFormats(){ Count = (UInt32Value)1U };
CellFormat cellFormat1 = new CellFormat(){ NumberFormatId = (UInt32Value)0U, FontId = (UInt32Value)0U, FillId = (UInt32Value)0U, BorderId = (UInt32Value)0U };
cellStyleFormats1.Append(cellFormat1);
CellFormats cellFormats1 = new CellFormats(){ Count = (UInt32Value)8U };
CellFormat cellFormat2 = new CellFormat(){ NumberFormatId = (UInt32Value)0U, FontId = (UInt32Value)0U, FillId = (UInt32Value)0U, BorderId = (UInt32Value)0U, FormatId = (UInt32Value)0U };
CellFormat cellFormat3 = new CellFormat(){ NumberFormatId = (UInt32Value)0U, FontId = (UInt32Value)0U, FillId = (UInt32Value)0U, BorderId = (UInt32Value)0U, FormatId = (UInt32Value)0U, ApplyAlignment = true };
Alignment alignment1 = new Alignment(){ Vertical = VerticalAlignmentValues.Center };
cellFormat3.Append(alignment1);
CellFormat cellFormat4 = new CellFormat(){ NumberFormatId = (UInt32Value)0U, FontId = (UInt32Value)0U, FillId = (UInt32Value)0U, BorderId = (UInt32Value)0U, FormatId = (UInt32Value)0U, ApplyAlignment = true };
Alignment alignment2 = new Alignment(){ Horizontal = HorizontalAlignmentValues.Center, Vertical = VerticalAlignmentValues.Center };
cellFormat4.Append(alignment2);
CellFormat cellFormat5 = new CellFormat(){ NumberFormatId = (UInt32Value)14U, FontId = (UInt32Value)0U, FillId = (UInt32Value)0U, BorderId = (UInt32Value)0U, FormatId = (UInt32Value)0U, ApplyNumberFormat = true, ApplyAlignment = true };
Alignment alignment3 = new Alignment(){ Vertical = VerticalAlignmentValues.Center };
cellFormat5.Append(alignment3);
CellFormat cellFormat6 = new CellFormat(){ NumberFormatId = (UInt32Value)164U, FontId = (UInt32Value)0U, FillId = (UInt32Value)0U, BorderId = (UInt32Value)0U, FormatId = (UInt32Value)0U, ApplyNumberFormat = true, ApplyAlignment = true };
Alignment alignment4 = new Alignment(){ Vertical = VerticalAlignmentValues.Center };
//.........这里部分代码省略.........
示例13: GenerateWorkbookStylesPart1Content
// Generates content of workbookStylesPart1.
private void GenerateWorkbookStylesPart1Content(WorkbookStylesPart workbookStylesPart1)
{
Stylesheet stylesheet1 = new Stylesheet(){ MCAttributes = new MarkupCompatibilityAttributes(){ Ignorable = "x14ac" } };
stylesheet1.AddNamespaceDeclaration("mc", "http://schemas.openxmlformats.org/markup-compatibility/2006");
stylesheet1.AddNamespaceDeclaration("x14ac", "http://schemas.microsoft.com/office/spreadsheetml/2009/9/ac");
Fonts fonts1 = new Fonts(){ Count = (UInt32Value)2U };
Font font1 = new Font();
FontSize fontSize1 = new FontSize(){ Val = 11D };
Color color1 = new Color(){ Theme = (UInt32Value)1U };
FontName fontName1 = new FontName(){ Val = "Calibri" };
FontFamilyNumbering fontFamilyNumbering1 = new FontFamilyNumbering(){ Val = 2 };
FontCharSet fontCharSet1 = new FontCharSet(){ Val = 162 };
FontScheme fontScheme2 = new FontScheme(){ Val = FontSchemeValues.Minor };
font1.Append(fontSize1);
font1.Append(color1);
font1.Append(fontName1);
font1.Append(fontFamilyNumbering1);
font1.Append(fontCharSet1);
font1.Append(fontScheme2);
Font font2 = new Font();
FontSize fontSize2 = new FontSize(){ Val = 6D };
FontName fontName2 = new FontName(){ Val = "Calibri" };
FontFamilyNumbering fontFamilyNumbering2 = new FontFamilyNumbering(){ Val = 3 };
FontCharSet fontCharSet2 = new FontCharSet(){ Val = 128 };
FontScheme fontScheme3 = new FontScheme(){ Val = FontSchemeValues.Minor };
font2.Append(fontSize2);
font2.Append(fontName2);
font2.Append(fontFamilyNumbering2);
font2.Append(fontCharSet2);
font2.Append(fontScheme3);
fonts1.Append(font1);
fonts1.Append(font2);
Fills fills1 = new Fills(){ Count = (UInt32Value)2U };
Fill fill1 = new Fill();
PatternFill patternFill1 = new PatternFill(){ PatternType = PatternValues.None };
fill1.Append(patternFill1);
Fill fill2 = new Fill();
PatternFill patternFill2 = new PatternFill(){ PatternType = PatternValues.Gray125 };
fill2.Append(patternFill2);
fills1.Append(fill1);
fills1.Append(fill2);
Borders borders1 = new Borders(){ Count = (UInt32Value)10U };
Border border1 = new Border();
LeftBorder leftBorder1 = new LeftBorder();
RightBorder rightBorder1 = new RightBorder();
TopBorder topBorder1 = new TopBorder();
BottomBorder bottomBorder1 = new BottomBorder();
DiagonalBorder diagonalBorder1 = new DiagonalBorder();
border1.Append(leftBorder1);
border1.Append(rightBorder1);
border1.Append(topBorder1);
border1.Append(bottomBorder1);
border1.Append(diagonalBorder1);
Border border2 = new Border();
LeftBorder leftBorder2 = new LeftBorder(){ Style = BorderStyleValues.Thin };
Color color2 = new Color(){ Indexed = (UInt32Value)8U };
leftBorder2.Append(color2);
RightBorder rightBorder2 = new RightBorder();
TopBorder topBorder2 = new TopBorder(){ Style = BorderStyleValues.Thin };
Color color3 = new Color(){ Indexed = (UInt32Value)8U };
topBorder2.Append(color3);
BottomBorder bottomBorder2 = new BottomBorder();
DiagonalBorder diagonalBorder2 = new DiagonalBorder();
border2.Append(leftBorder2);
border2.Append(rightBorder2);
border2.Append(topBorder2);
border2.Append(bottomBorder2);
border2.Append(diagonalBorder2);
Border border3 = new Border();
LeftBorder leftBorder3 = new LeftBorder(){ Style = BorderStyleValues.Thin };
Color color4 = new Color(){ Indexed = (UInt32Value)65U };
leftBorder3.Append(color4);
RightBorder rightBorder3 = new RightBorder();
TopBorder topBorder3 = new TopBorder(){ Style = BorderStyleValues.Thin };
//.........这里部分代码省略.........
示例14: CreateXmlFont
/// <summary>
/// Creates the XML font.
/// </summary>
/// <param name="font">The font.</param>
/// <returns>Font</returns>
public Font CreateXmlFont(System.Drawing.Font font)
{
var xmlFont = new Font();
xmlFont.Append(new FontName { Val = font.Name });
xmlFont.Append(new FontSize { Val = font.SizeInPoints });
//xmlFont.Append(new FontFamily() {Val = font.FontFamily.Name});
if (font.Bold) xmlFont.Append(new Bold());
if (font.Italic) xmlFont.Append(new Italic());
if (font.Underline) xmlFont.Append(new Underline());
return xmlFont;
}
示例15: GenerateFontTablePart1Content
// Generates content of fontTablePart1.
private void GenerateFontTablePart1Content(FontTablePart fontTablePart1)
{
Fonts fonts1 = new Fonts();
fonts1.AddNamespaceDeclaration("w", "http://schemas.openxmlformats.org/wordprocessingml/2006/main");
fonts1.AddNamespaceDeclaration("r", "http://schemas.openxmlformats.org/officeDocument/2006/relationships");
Font font1 = new Font() { Name = "Times New Roman" };
FontCharSet fontCharSet1 = new FontCharSet() { Val = "00", StrictCharacterSet = new EnumValue<StrictCharacterSet>() { InnerText = "windows-1252" } };
FontFamily fontFamily1 = new FontFamily() { Val = FontFamilyValues.Roman };
Pitch pitch1 = new Pitch() { Val = FontPitchValues.Variable };
font1.Append(fontCharSet1);
font1.Append(fontFamily1);
font1.Append(pitch1);
Font font2 = new Font() { Name = "Symbol" };
FontCharSet fontCharSet2 = new FontCharSet() { Val = "02" };
FontFamily fontFamily2 = new FontFamily() { Val = FontFamilyValues.Roman };
Pitch pitch2 = new Pitch() { Val = FontPitchValues.Variable };
font2.Append(fontCharSet2);
font2.Append(fontFamily2);
font2.Append(pitch2);
Font font3 = new Font() { Name = "Arial" };
FontCharSet fontCharSet3 = new FontCharSet() { Val = "00", StrictCharacterSet = new EnumValue<StrictCharacterSet>() { InnerText = "windows-1252" } };
FontFamily fontFamily3 = new FontFamily() { Val = FontFamilyValues.Swiss };
Pitch pitch3 = new Pitch() { Val = FontPitchValues.Variable };
font3.Append(fontCharSet3);
font3.Append(fontFamily3);
font3.Append(pitch3);
Font font4 = new Font() { Name = "Liberation Serif" };
AltName altName1 = new AltName() { Val = "Times New Roman" };
FontCharSet fontCharSet4 = new FontCharSet() { Val = "cc", StrictCharacterSet = StrictCharacterSet.chsRussian };
FontFamily fontFamily4 = new FontFamily() { Val = FontFamilyValues.Roman };
Pitch pitch4 = new Pitch() { Val = FontPitchValues.Variable };
font4.Append(altName1);
font4.Append(fontCharSet4);
font4.Append(fontFamily4);
font4.Append(pitch4);
Font font5 = new Font() { Name = "Times New Roman" };
FontCharSet fontCharSet5 = new FontCharSet() { Val = "cc", StrictCharacterSet = StrictCharacterSet.chsRussian };
FontFamily fontFamily5 = new FontFamily() { Val = FontFamilyValues.Roman };
Pitch pitch5 = new Pitch() { Val = FontPitchValues.Variable };
font5.Append(fontCharSet5);
font5.Append(fontFamily5);
font5.Append(pitch5);
Font font6 = new Font() { Name = "Liberation Sans" };
AltName altName2 = new AltName() { Val = "Arial" };
FontCharSet fontCharSet6 = new FontCharSet() { Val = "cc", StrictCharacterSet = StrictCharacterSet.chsRussian };
FontFamily fontFamily6 = new FontFamily() { Val = FontFamilyValues.Roman };
Pitch pitch6 = new Pitch() { Val = FontPitchValues.Variable };
font6.Append(altName2);
font6.Append(fontCharSet6);
font6.Append(fontFamily6);
font6.Append(pitch6);
Font font7 = new Font() { Name = "Symbol" };
FontCharSet fontCharSet7 = new FontCharSet() { Val = "cc", StrictCharacterSet = StrictCharacterSet.chsRussian };
FontFamily fontFamily7 = new FontFamily() { Val = FontFamilyValues.Roman };
Pitch pitch7 = new Pitch() { Val = FontPitchValues.Variable };
font7.Append(fontCharSet7);
font7.Append(fontFamily7);
font7.Append(pitch7);
fonts1.Append(font1);
fonts1.Append(font2);
fonts1.Append(font3);
fonts1.Append(font4);
fonts1.Append(font5);
fonts1.Append(font6);
fonts1.Append(font7);
fontTablePart1.Fonts = fonts1;
}