本文整理汇总了C#中Header.Append方法的典型用法代码示例。如果您正苦于以下问题:C# Header.Append方法的具体用法?C# Header.Append怎么用?C# Header.Append使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Header
的用法示例。
在下文中一共展示了Header.Append方法的12个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: TotalTest
public void TotalTest()
{
const int max = 5;
var sb = new StringBuilder();
for (int i = 0; i < max; i++) {
sb.Append(string.Format("key_{0:D3}: val_{0:D3}\r\n", i));
}
byte [] buf = Bytes.Create(sb.ToString());
var header = new Header(buf);
//GetBytes()
//自動的に追加される空行を追加すると、初期化したbyte[]と同じになるはず
var tmp = Bytes.Create(header.GetBytes(),"\r\n");
for (int i=0;i<buf.Length;i++) {
Assert.AreEqual(buf[i],tmp[i]);
}
//Count
Assert.AreEqual(header.Count,max);
for(var i=0;i<header.Count;i++){
var key = string.Format("key_{0:D3}",i);
var valStr = string.Format("val_{0:D3}",i);
//GetVal(string key)
Assert.AreEqual(header.GetVal(key), valStr);
//Replace(string key,string str)
var replaceStr = string.Format("replace_{0:D3}",i);
header.Replace(key,replaceStr);
Assert.AreEqual(header.GetVal(key), replaceStr);
}
const int appendMax = 3;
for (int i = 0; i < appendMax; i++) {
//Append(string key,string val)
var key = string.Format("AppendKey_{0:D3}", i);
var val = string.Format("AppendVal_{0:D3}", i);
header.Append(key, Encoding.ASCII.GetBytes(val));
//string s = header.GetVal(key);
Assert.AreEqual(header.GetVal(key), val);
}
Assert.AreEqual(header.Count, max + appendMax);
}
示例2: GenerateHeaderPartContent
private static void GenerateHeaderPartContent(HeaderPart part)
{
Header header1 = new Header() { MCAttributes = new MarkupCompatibilityAttributes() { Ignorable = "w14 wp14" } };
header1.AddNamespaceDeclaration("wpc", "http://schemas.microsoft.com/office/word/2010/wordprocessingCanvas");
header1.AddNamespaceDeclaration("mc", "http://schemas.openxmlformats.org/markup-compatibility/2006");
header1.AddNamespaceDeclaration("o", "urn:schemas-microsoft-com:office:office");
header1.AddNamespaceDeclaration("r", "http://schemas.openxmlformats.org/officeDocument/2006/relationships");
header1.AddNamespaceDeclaration("m", "http://schemas.openxmlformats.org/officeDocument/2006/math");
header1.AddNamespaceDeclaration("v", "urn:schemas-microsoft-com:vml");
header1.AddNamespaceDeclaration("wp14", "http://schemas.microsoft.com/office/word/2010/wordprocessingDrawing");
header1.AddNamespaceDeclaration("wp", "http://schemas.openxmlformats.org/drawingml/2006/wordprocessingDrawing");
header1.AddNamespaceDeclaration("w10", "urn:schemas-microsoft-com:office:word");
header1.AddNamespaceDeclaration("w", "http://schemas.openxmlformats.org/wordprocessingml/2006/main");
header1.AddNamespaceDeclaration("w14", "http://schemas.microsoft.com/office/word/2010/wordml");
header1.AddNamespaceDeclaration("wpg", "http://schemas.microsoft.com/office/word/2010/wordprocessingGroup");
header1.AddNamespaceDeclaration("wpi", "http://schemas.microsoft.com/office/word/2010/wordprocessingInk");
header1.AddNamespaceDeclaration("wne", "http://schemas.microsoft.com/office/word/2006/wordml");
header1.AddNamespaceDeclaration("wps", "http://schemas.microsoft.com/office/word/2010/wordprocessingShape");
Paragraph paragraph1 = new Paragraph() { RsidParagraphAddition = "00164C17", RsidRunAdditionDefault = "00164C17" };
ParagraphProperties paragraphProperties1 = new ParagraphProperties();
ParagraphStyleId paragraphStyleId1 = new ParagraphStyleId() { Val = "Header" };
paragraphProperties1.Append(paragraphStyleId1);
Run run1 = new Run();
DocumentFormat.OpenXml.Wordprocessing.Text text1 = new DocumentFormat.OpenXml.Wordprocessing.Text();
text1.Text = "Header";
run1.Append(text1);
paragraph1.Append(paragraphProperties1);
paragraph1.Append(run1);
header1.Append(paragraph1);
part.Header = header1;
}
示例3: HeaderTest
public void HeaderTest(string key, string val)
{
var request = new Request(null,null);
var header = new Header();
header.Append("Connection", Encoding.ASCII.GetBytes("keep-alive"));
header.Append("User-Agent", Encoding.ASCII.GetBytes("Mozilla/5.0 (compatible; MSIE 9.0; Windows NT 6.1; WOW64; Trident/5.0)"));
header.Append("Accept", Encoding.ASCII.GetBytes("text/html,application/xhtml"));
header.Append("Accept-Encoding", Encoding.ASCII.GetBytes("gzip,deflate,sdch"));
header.Append("Accept-Language", Encoding.ASCII.GetBytes("ja,en-US;q=0.8,en;q=0.6"));
header.Append("Accept-Charset", Encoding.ASCII.GetBytes("Shift_JIS,utf-8;q=0.7,*;q=0.3"));
header.Append("Cache-Control", Encoding.ASCII.GetBytes("max-age=0"));
var tcpObj = new SockTcp(new Kernel(), new Ip("0.0.0.0"), 88, 3,null);
const string fileName = "";
var env = new Env(_kernel,new Conf(option), request, header, tcpObj, fileName);
foreach (var e in env) {
if (e.Key == key) {
Assert.AreEqual(e.Val, val);
return;
}
}
Assert.AreEqual(key, "");
}
示例4: GenerateHeaderPart1Content
// Generates content of headerPart1.
private void GenerateHeaderPart1Content(HeaderPart headerPart1)
{
Header header1 = new Header() { MCAttributes = new MarkupCompatibilityAttributes() { Ignorable = "w14 wp14" } };
header1.AddNamespaceDeclaration("wpc", "http://schemas.microsoft.com/office/word/2010/wordprocessingCanvas");
header1.AddNamespaceDeclaration("mc", "http://schemas.openxmlformats.org/markup-compatibility/2006");
header1.AddNamespaceDeclaration("o", "urn:schemas-microsoft-com:office:office");
header1.AddNamespaceDeclaration("r", "http://schemas.openxmlformats.org/officeDocument/2006/relationships");
header1.AddNamespaceDeclaration("m", "http://schemas.openxmlformats.org/officeDocument/2006/math");
header1.AddNamespaceDeclaration("v", "urn:schemas-microsoft-com:vml");
header1.AddNamespaceDeclaration("wp14", "http://schemas.microsoft.com/office/word/2010/wordprocessingDrawing");
header1.AddNamespaceDeclaration("wp", "http://schemas.openxmlformats.org/drawingml/2006/wordprocessingDrawing");
header1.AddNamespaceDeclaration("w10", "urn:schemas-microsoft-com:office:word");
header1.AddNamespaceDeclaration("w", "http://schemas.openxmlformats.org/wordprocessingml/2006/main");
header1.AddNamespaceDeclaration("w14", "http://schemas.microsoft.com/office/word/2010/wordml");
header1.AddNamespaceDeclaration("wpg", "http://schemas.microsoft.com/office/word/2010/wordprocessingGroup");
header1.AddNamespaceDeclaration("wpi", "http://schemas.microsoft.com/office/word/2010/wordprocessingInk");
header1.AddNamespaceDeclaration("wne", "http://schemas.microsoft.com/office/word/2006/wordml");
header1.AddNamespaceDeclaration("wps", "http://schemas.microsoft.com/office/word/2010/wordprocessingShape");
Paragraph paragraph52 = new Paragraph() { RsidParagraphAddition = "004F7F90", RsidRunAdditionDefault = "00900A10" };
ParagraphProperties paragraphProperties50 = new ParagraphProperties();
WidowControl widowControl50 = new WidowControl() { Val = false };
AutoSpaceDE autoSpaceDE50 = new AutoSpaceDE() { Val = false };
AutoSpaceDN autoSpaceDN50 = new AutoSpaceDN() { Val = false };
AdjustRightIndent adjustRightIndent50 = new AdjustRightIndent() { Val = false };
SpacingBetweenLines spacingBetweenLines36 = new SpacingBetweenLines() { After = "0", Line = "240", LineRule = LineSpacingRuleValues.Auto };
Justification justification11 = new Justification() { Val = JustificationValues.Center };
ParagraphMarkRunProperties paragraphMarkRunProperties50 = new ParagraphMarkRunProperties();
RunFonts runFonts105 = new RunFonts() { Ascii = "Verdana", HighAnsi = "Verdana", EastAsia = "New Roman", ComplexScript = "Verdana" };
FontSize fontSize105 = new FontSize() { Val = "16" };
FontSizeComplexScript fontSizeComplexScript105 = new FontSizeComplexScript() { Val = "16" };
paragraphMarkRunProperties50.Append(runFonts105);
paragraphMarkRunProperties50.Append(fontSize105);
paragraphMarkRunProperties50.Append(fontSizeComplexScript105);
paragraphProperties50.Append(widowControl50);
paragraphProperties50.Append(autoSpaceDE50);
paragraphProperties50.Append(autoSpaceDN50);
paragraphProperties50.Append(adjustRightIndent50);
paragraphProperties50.Append(spacingBetweenLines36);
paragraphProperties50.Append(justification11);
paragraphProperties50.Append(paragraphMarkRunProperties50);
Run run56 = new Run();
RunProperties runProperties56 = new RunProperties();
RunFonts runFonts106 = new RunFonts() { Ascii = "Verdana", HighAnsi = "Verdana", EastAsia = "New Roman", ComplexScript = "Verdana" };
Bold bold19 = new Bold();
BoldComplexScript boldComplexScript19 = new BoldComplexScript();
FontSize fontSize106 = new FontSize() { Val = "16" };
FontSizeComplexScript fontSizeComplexScript106 = new FontSizeComplexScript() { Val = "16" };
runProperties56.Append(runFonts106);
runProperties56.Append(bold19);
runProperties56.Append(boldComplexScript19);
runProperties56.Append(fontSize106);
runProperties56.Append(fontSizeComplexScript106);
Text text48 = new Text() { Space = SpaceProcessingModeValues.Preserve };
text48.Text = "Смоленская государственная медицинская академия ";
run56.Append(runProperties56);
run56.Append(text48);
paragraph52.Append(paragraphProperties50);
paragraph52.Append(run56);
Paragraph paragraph53 = new Paragraph() { RsidParagraphAddition = "004F7F90", RsidRunAdditionDefault = "00900A10" };
ParagraphProperties paragraphProperties51 = new ParagraphProperties();
WidowControl widowControl51 = new WidowControl() { Val = false };
AutoSpaceDE autoSpaceDE51 = new AutoSpaceDE() { Val = false };
AutoSpaceDN autoSpaceDN51 = new AutoSpaceDN() { Val = false };
AdjustRightIndent adjustRightIndent51 = new AdjustRightIndent() { Val = false };
SpacingBetweenLines spacingBetweenLines37 = new SpacingBetweenLines() { After = "0", Line = "240", LineRule = LineSpacingRuleValues.Auto };
Justification justification12 = new Justification() { Val = JustificationValues.Center };
ParagraphMarkRunProperties paragraphMarkRunProperties51 = new ParagraphMarkRunProperties();
RunFonts runFonts107 = new RunFonts() { Ascii = "Verdana", HighAnsi = "Verdana", EastAsia = "New Roman", ComplexScript = "Verdana" };
FontSize fontSize107 = new FontSize() { Val = "16" };
FontSizeComplexScript fontSizeComplexScript107 = new FontSizeComplexScript() { Val = "16" };
paragraphMarkRunProperties51.Append(runFonts107);
paragraphMarkRunProperties51.Append(fontSize107);
paragraphMarkRunProperties51.Append(fontSizeComplexScript107);
paragraphProperties51.Append(widowControl51);
paragraphProperties51.Append(autoSpaceDE51);
paragraphProperties51.Append(autoSpaceDN51);
paragraphProperties51.Append(adjustRightIndent51);
paragraphProperties51.Append(spacingBetweenLines37);
paragraphProperties51.Append(justification12);
paragraphProperties51.Append(paragraphMarkRunProperties51);
Run run57 = new Run();
RunProperties runProperties57 = new RunProperties();
//.........这里部分代码省略.........
示例5: ApplyHeader
private void ApplyHeader(HeaderPart headerPart)
{
var header1 = new Header();
header1.AddNamespaceDeclaration("ve", "http://schemas.openxmlformats.org/markup-compatibility/2006");
header1.AddNamespaceDeclaration("o", "urn:schemas-microsoft-com:office:office");
header1.AddNamespaceDeclaration("r", "http://schemas.openxmlformats.org/officeDocument/2006/relationships");
header1.AddNamespaceDeclaration("m", "http://schemas.openxmlformats.org/officeDocument/2006/math");
header1.AddNamespaceDeclaration("v", "urn:schemas-microsoft-com:vml");
header1.AddNamespaceDeclaration("wp", "http://schemas.openxmlformats.org/drawingml/2006/wordprocessingDrawing");
header1.AddNamespaceDeclaration("w10", "urn:schemas-microsoft-com:office:word");
header1.AddNamespaceDeclaration("w", "http://schemas.openxmlformats.org/wordprocessingml/2006/main");
header1.AddNamespaceDeclaration("wne", "http://schemas.microsoft.com/office/word/2006/wordml");
var paragraph1 = new Paragraph { RsidParagraphAddition = "005641D2", RsidRunAdditionDefault = "005641D2" };
var paragraphProperties1 = new ParagraphProperties();
var paragraphStyleId1 = new ParagraphStyleId { Val = "Header" };
paragraphProperties1.Append(paragraphStyleId1);
var run1 = new Run();
var text1 = new Text();
if (!string.IsNullOrEmpty(this.configuration.SystemUnderTestName) &&
!string.IsNullOrEmpty(this.configuration.SystemUnderTestVersion))
{
text1.Text =
$"{this.configuration.SystemUnderTestName}, version {this.configuration.SystemUnderTestVersion}";
}
else if (!string.IsNullOrEmpty(this.configuration.SystemUnderTestName))
{
text1.Text = this.configuration.SystemUnderTestName;
}
else if (!string.IsNullOrEmpty(this.configuration.SystemUnderTestVersion))
{
text1.Text = $"Features for version {this.configuration.SystemUnderTestVersion}";
}
run1.Append(text1);
paragraph1.Append(paragraphProperties1);
paragraph1.Append(run1);
var paragraph2 = new Paragraph { RsidParagraphAddition = "005641D2", RsidRunAdditionDefault = "005641D2" };
var paragraphProperties2 = new ParagraphProperties();
var paragraphStyleId2 = new ParagraphStyleId { Val = "Header" };
paragraphProperties2.Append(paragraphStyleId2);
paragraph2.Append(paragraphProperties2);
header1.Append(paragraph1);
header1.Append(paragraph2);
headerPart.Header = header1;
}
示例6: GenerateHeaderPart1Content
// Generates content of headerPart1.
private void GenerateHeaderPart1Content(HeaderPart headerPart1)
{
Header header1 = new Header() { MCAttributes = new MarkupCompatibilityAttributes() { Ignorable = "w14 w15 w16se wp14" } };
header1.AddNamespaceDeclaration("wpc", "http://schemas.microsoft.com/office/word/2010/wordprocessingCanvas");
header1.AddNamespaceDeclaration("cx", "http://schemas.microsoft.com/office/drawing/2014/chartex");
header1.AddNamespaceDeclaration("cx1", "http://schemas.microsoft.com/office/drawing/2015/9/8/chartex");
header1.AddNamespaceDeclaration("cx2", "http://schemas.microsoft.com/office/drawing/2015/10/21/chartex");
header1.AddNamespaceDeclaration("mc", "http://schemas.openxmlformats.org/markup-compatibility/2006");
header1.AddNamespaceDeclaration("o", "urn:schemas-microsoft-com:office:office");
header1.AddNamespaceDeclaration("r", "http://schemas.openxmlformats.org/officeDocument/2006/relationships");
header1.AddNamespaceDeclaration("m", "http://schemas.openxmlformats.org/officeDocument/2006/math");
header1.AddNamespaceDeclaration("v", "urn:schemas-microsoft-com:vml");
header1.AddNamespaceDeclaration("wp14", "http://schemas.microsoft.com/office/word/2010/wordprocessingDrawing");
header1.AddNamespaceDeclaration("wp", "http://schemas.openxmlformats.org/drawingml/2006/wordprocessingDrawing");
header1.AddNamespaceDeclaration("w10", "urn:schemas-microsoft-com:office:word");
header1.AddNamespaceDeclaration("w", "http://schemas.openxmlformats.org/wordprocessingml/2006/main");
header1.AddNamespaceDeclaration("w14", "http://schemas.microsoft.com/office/word/2010/wordml");
header1.AddNamespaceDeclaration("w15", "http://schemas.microsoft.com/office/word/2012/wordml");
header1.AddNamespaceDeclaration("w16se", "http://schemas.microsoft.com/office/word/2015/wordml/symex");
header1.AddNamespaceDeclaration("wpg", "http://schemas.microsoft.com/office/word/2010/wordprocessingGroup");
header1.AddNamespaceDeclaration("wpi", "http://schemas.microsoft.com/office/word/2010/wordprocessingInk");
header1.AddNamespaceDeclaration("wne", "http://schemas.microsoft.com/office/word/2006/wordml");
header1.AddNamespaceDeclaration("wps", "http://schemas.microsoft.com/office/word/2010/wordprocessingShape");
Paragraph paragraph371 = new Paragraph() { RsidParagraphAddition = "0094109A", RsidParagraphProperties = "00624202", RsidRunAdditionDefault = "0094109A", ParagraphId = "0AAC1AD1", TextId = "295351A7" };
ParagraphProperties paragraphProperties368 = new ParagraphProperties();
ParagraphStyleId paragraphStyleId28 = new ParagraphStyleId() { Val = "Footer" };
WidowControl widowControl1 = new WidowControl() { Val = false };
Indentation indentation25 = new Indentation() { End = "360" };
paragraphProperties368.Append(paragraphStyleId28);
paragraphProperties368.Append(widowControl1);
paragraphProperties368.Append(indentation25);
Run run755 = new Run();
RunProperties runProperties797 = new RunProperties();
NoProof noProof4 = new NoProof();
runProperties797.Append(noProof4);
Drawing drawing2 = new Drawing();
Wp.Inline inline1 = new Wp.Inline() { DistanceFromTop = (UInt32Value)0U, DistanceFromBottom = (UInt32Value)0U, DistanceFromLeft = (UInt32Value)0U, DistanceFromRight = (UInt32Value)0U, AnchorId = "0AAC1AD5", EditId = "0AAC1AD6" };
Wp.Extent extent2 = new Wp.Extent() { Cx = 1238250L, Cy = 190500L };
Wp.EffectExtent effectExtent2 = new Wp.EffectExtent() { LeftEdge = 0L, TopEdge = 0L, RightEdge = 0L, BottomEdge = 0L };
Wp.DocProperties docProperties2 = new Wp.DocProperties() { Id = (UInt32Value)1U, Name = "Picture 1" };
Wp.NonVisualGraphicFrameDrawingProperties nonVisualGraphicFrameDrawingProperties2 = new Wp.NonVisualGraphicFrameDrawingProperties();
A.GraphicFrameLocks graphicFrameLocks2 = new A.GraphicFrameLocks() { NoChangeAspect = true };
graphicFrameLocks2.AddNamespaceDeclaration("a", "http://schemas.openxmlformats.org/drawingml/2006/main");
nonVisualGraphicFrameDrawingProperties2.Append(graphicFrameLocks2);
A.Graphic graphic2 = new A.Graphic();
graphic2.AddNamespaceDeclaration("a", "http://schemas.openxmlformats.org/drawingml/2006/main");
A.GraphicData graphicData2 = new A.GraphicData() { Uri = "http://schemas.openxmlformats.org/drawingml/2006/picture" };
Pic.Picture picture2 = new Pic.Picture();
picture2.AddNamespaceDeclaration("pic", "http://schemas.openxmlformats.org/drawingml/2006/picture");
Pic.NonVisualPictureProperties nonVisualPictureProperties2 = new Pic.NonVisualPictureProperties();
Pic.NonVisualDrawingProperties nonVisualDrawingProperties2 = new Pic.NonVisualDrawingProperties() { Id = (UInt32Value)0U, Name = "Picture 1" };
Pic.NonVisualPictureDrawingProperties nonVisualPictureDrawingProperties2 = new Pic.NonVisualPictureDrawingProperties();
A.PictureLocks pictureLocks2 = new A.PictureLocks() { NoChangeAspect = true, NoChangeArrowheads = true };
nonVisualPictureDrawingProperties2.Append(pictureLocks2);
nonVisualPictureProperties2.Append(nonVisualDrawingProperties2);
nonVisualPictureProperties2.Append(nonVisualPictureDrawingProperties2);
Pic.BlipFill blipFill2 = new Pic.BlipFill();
A.Blip blip2 = new A.Blip() { Embed = "rId1" };
A.BlipExtensionList blipExtensionList2 = new A.BlipExtensionList();
A.BlipExtension blipExtension2 = new A.BlipExtension() { Uri = "{28A0092B-C50C-407E-A947-70E740481C1C}" };
A14.UseLocalDpi useLocalDpi2 = new A14.UseLocalDpi() { Val = false };
useLocalDpi2.AddNamespaceDeclaration("a14", "http://schemas.microsoft.com/office/drawing/2010/main");
blipExtension2.Append(useLocalDpi2);
blipExtensionList2.Append(blipExtension2);
blip2.Append(blipExtensionList2);
A.SourceRectangle sourceRectangle2 = new A.SourceRectangle();
A.Stretch stretch2 = new A.Stretch();
A.FillRectangle fillRectangle2 = new A.FillRectangle();
stretch2.Append(fillRectangle2);
blipFill2.Append(blip2);
//.........这里部分代码省略.........
示例7: GenerateHeaderPart2Content
// Generates content of headerPart2.
private void GenerateHeaderPart2Content(HeaderPart headerPart2)
{
Header header2 = new Header();
Paragraph paragraph51 = new Paragraph() { RsidParagraphAddition = "00C913B8", RsidParagraphProperties = "00C913B8", RsidRunAdditionDefault = "00740A1C" };
ParagraphProperties paragraphProperties46 = new ParagraphProperties();
ParagraphStyleId paragraphStyleId44 = new ParagraphStyleId() { Val = "En-tte" };
ParagraphBorders paragraphBorders14 = new ParagraphBorders();
BottomBorder bottomBorder13 = new BottomBorder() { Val = BorderValues.None, Color = "auto", Size = (UInt32Value)0U, Space = (UInt32Value)0U };
paragraphBorders14.Append(bottomBorder13);
SpacingBetweenLines spacingBetweenLines51 = new SpacingBetweenLines() { After = "60" };
ParagraphMarkRunProperties paragraphMarkRunProperties17 = new ParagraphMarkRunProperties();
RunStyle runStyle10 = new RunStyle() { Val = "DateCar" };
RunFonts runFonts52 = new RunFonts() { EastAsia = "MS Mincho" };
FontSize fontSize49 = new FontSize() { Val = "20" };
FontSizeComplexScript fontSizeComplexScript50 = new FontSizeComplexScript() { Val = "20" };
paragraphMarkRunProperties17.Append(runStyle10);
paragraphMarkRunProperties17.Append(runFonts52);
paragraphMarkRunProperties17.Append(fontSize49);
paragraphMarkRunProperties17.Append(fontSizeComplexScript50);
paragraphProperties46.Append(paragraphStyleId44);
paragraphProperties46.Append(paragraphBorders14);
paragraphProperties46.Append(spacingBetweenLines51);
paragraphProperties46.Append(paragraphMarkRunProperties17);
Run run54 = new Run();
RunProperties runProperties28 = new RunProperties();
NoProof noProof15 = new NoProof();
Languages languages34 = new Languages() { Val = "fr-CA", EastAsia = "fr-CA" };
runProperties28.Append(noProof15);
runProperties28.Append(languages34);
Drawing drawing15 = new Drawing();
Wp.Anchor anchor4 = new Wp.Anchor() { DistanceFromTop = (UInt32Value)0U, DistanceFromBottom = (UInt32Value)0U, DistanceFromLeft = (UInt32Value)114300U, DistanceFromRight = (UInt32Value)114300U, SimplePos = false, RelativeHeight = (UInt32Value)251659264U, BehindDoc = true, Locked = false, LayoutInCell = true, AllowOverlap = true };
Wp.SimplePosition simplePosition4 = new Wp.SimplePosition() { X = 0L, Y = 0L };
Wp.HorizontalPosition horizontalPosition4 = new Wp.HorizontalPosition() { RelativeFrom = Wp.HorizontalRelativePositionValues.Column };
Wp.PositionOffset positionOffset7 = new Wp.PositionOffset();
positionOffset7.Text = "8890";
horizontalPosition4.Append(positionOffset7);
Wp.VerticalPosition verticalPosition4 = new Wp.VerticalPosition() { RelativeFrom = Wp.VerticalRelativePositionValues.Paragraph };
Wp.PositionOffset positionOffset8 = new Wp.PositionOffset();
positionOffset8.Text = "8890";
verticalPosition4.Append(positionOffset8);
Wp.Extent extent15 = new Wp.Extent() { Cx = 6848475L, Cy = 438150L };
Wp.EffectExtent effectExtent15 = new Wp.EffectExtent() { LeftEdge = 19050L, TopEdge = 0L, RightEdge = 9525L, BottomEdge = 0L };
Wp.WrapNone wrapNone4 = new Wp.WrapNone();
Wp.DocProperties docProperties15 = new Wp.DocProperties() { Id = (UInt32Value)65U, Name = "Image 65", Description = "RADAR_Opinion_Page2_BNR" };
Wp.NonVisualGraphicFrameDrawingProperties nonVisualGraphicFrameDrawingProperties15 = new Wp.NonVisualGraphicFrameDrawingProperties();
A.GraphicFrameLocks graphicFrameLocks15 = new A.GraphicFrameLocks() { NoChangeAspect = true };
nonVisualGraphicFrameDrawingProperties15.Append(graphicFrameLocks15);
A.Graphic graphic15 = new A.Graphic();
A.GraphicData graphicData15 = new A.GraphicData() { Uri = "http://schemas.openxmlformats.org/drawingml/2006/picture" };
Pic.Picture picture15 = new Pic.Picture();
Pic.NonVisualPictureProperties nonVisualPictureProperties15 = new Pic.NonVisualPictureProperties();
Pic.NonVisualDrawingProperties nonVisualDrawingProperties15 = new Pic.NonVisualDrawingProperties() { Id = (UInt32Value)0U, Name = "Picture 65", Description = "RADAR_Opinion_Page2_BNR" };
Pic.NonVisualPictureDrawingProperties nonVisualPictureDrawingProperties15 = new Pic.NonVisualPictureDrawingProperties();
A.PictureLocks pictureLocks15 = new A.PictureLocks() { NoChangeAspect = true, NoChangeArrowheads = true };
nonVisualPictureDrawingProperties15.Append(pictureLocks15);
nonVisualPictureProperties15.Append(nonVisualDrawingProperties15);
nonVisualPictureProperties15.Append(nonVisualPictureDrawingProperties15);
Pic.BlipFill blipFill15 = new Pic.BlipFill();
A.Blip blip15 = new A.Blip() { Embed = "rId1" };
A.SourceRectangle sourceRectangle15 = new A.SourceRectangle();
A.Stretch stretch15 = new A.Stretch();
A.FillRectangle fillRectangle15 = new A.FillRectangle();
stretch15.Append(fillRectangle15);
blipFill15.Append(blip15);
blipFill15.Append(sourceRectangle15);
blipFill15.Append(stretch15);
Pic.ShapeProperties shapeProperties15 = new Pic.ShapeProperties() { BlackWhiteMode = A.BlackWhiteModeValues.Auto };
A.Transform2D transform2D15 = new A.Transform2D();
//.........这里部分代码省略.........
示例8: GenerateHeaderPart1Content
// Generates content of headerPart1.
private void GenerateHeaderPart1Content(HeaderPart headerPart1)
{
Header header1 = new Header();
Paragraph paragraph35 = new Paragraph() { RsidParagraphAddition = "00AB4921", RsidParagraphProperties = "002A7539", RsidRunAdditionDefault = "00740A1C" };
ParagraphProperties paragraphProperties34 = new ParagraphProperties();
ParagraphStyleId paragraphStyleId33 = new ParagraphStyleId() { Val = "En-tte" };
ParagraphBorders paragraphBorders3 = new ParagraphBorders();
BottomBorder bottomBorder4 = new BottomBorder() { Val = BorderValues.None, Color = "auto", Size = (UInt32Value)0U, Space = (UInt32Value)0U };
paragraphBorders3.Append(bottomBorder4);
SpacingBetweenLines spacingBetweenLines20 = new SpacingBetweenLines() { After = "60" };
ParagraphMarkRunProperties paragraphMarkRunProperties15 = new ParagraphMarkRunProperties();
RunStyle runStyle7 = new RunStyle() { Val = "DateCar" };
FontSize fontSize10 = new FontSize() { Val = "20" };
FontSizeComplexScript fontSizeComplexScript19 = new FontSizeComplexScript() { Val = "20" };
paragraphMarkRunProperties15.Append(runStyle7);
paragraphMarkRunProperties15.Append(fontSize10);
paragraphMarkRunProperties15.Append(fontSizeComplexScript19);
paragraphProperties34.Append(paragraphStyleId33);
paragraphProperties34.Append(paragraphBorders3);
paragraphProperties34.Append(spacingBetweenLines20);
paragraphProperties34.Append(paragraphMarkRunProperties15);
Run run43 = new Run();
RunProperties runProperties24 = new RunProperties();
NoProof noProof12 = new NoProof();
Languages languages12 = new Languages() { Val = "fr-CA", EastAsia = "fr-CA" };
runProperties24.Append(noProof12);
runProperties24.Append(languages12);
Drawing drawing12 = new Drawing();
Wp.Anchor anchor2 = new Wp.Anchor() { DistanceFromTop = (UInt32Value)0U, DistanceFromBottom = (UInt32Value)0U, DistanceFromLeft = (UInt32Value)114300U, DistanceFromRight = (UInt32Value)114300U, SimplePos = false, RelativeHeight = (UInt32Value)251658240U, BehindDoc = true, Locked = false, LayoutInCell = true, AllowOverlap = true };
Wp.SimplePosition simplePosition2 = new Wp.SimplePosition() { X = 0L, Y = 0L };
Wp.HorizontalPosition horizontalPosition2 = new Wp.HorizontalPosition() { RelativeFrom = Wp.HorizontalRelativePositionValues.Column };
Wp.PositionOffset positionOffset3 = new Wp.PositionOffset();
positionOffset3.Text = "0";
horizontalPosition2.Append(positionOffset3);
Wp.VerticalPosition verticalPosition2 = new Wp.VerticalPosition() { RelativeFrom = Wp.VerticalRelativePositionValues.Paragraph };
Wp.PositionOffset positionOffset4 = new Wp.PositionOffset();
positionOffset4.Text = "0";
verticalPosition2.Append(positionOffset4);
Wp.Extent extent12 = new Wp.Extent() { Cx = 6858000L, Cy = 714375L };
Wp.EffectExtent effectExtent12 = new Wp.EffectExtent() { LeftEdge = 19050L, TopEdge = 0L, RightEdge = 0L, BottomEdge = 0L };
Wp.WrapNone wrapNone2 = new Wp.WrapNone();
Wp.DocProperties docProperties12 = new Wp.DocProperties() { Id = (UInt32Value)54U, Name = "Image 54", Description = "RADAR_Opinion_BNR" };
Wp.NonVisualGraphicFrameDrawingProperties nonVisualGraphicFrameDrawingProperties12 = new Wp.NonVisualGraphicFrameDrawingProperties();
A.GraphicFrameLocks graphicFrameLocks12 = new A.GraphicFrameLocks() { NoChangeAspect = true };
nonVisualGraphicFrameDrawingProperties12.Append(graphicFrameLocks12);
A.Graphic graphic12 = new A.Graphic();
A.GraphicData graphicData12 = new A.GraphicData() { Uri = "http://schemas.openxmlformats.org/drawingml/2006/picture" };
Pic.Picture picture12 = new Pic.Picture();
Pic.NonVisualPictureProperties nonVisualPictureProperties12 = new Pic.NonVisualPictureProperties();
Pic.NonVisualDrawingProperties nonVisualDrawingProperties12 = new Pic.NonVisualDrawingProperties() { Id = (UInt32Value)0U, Name = "Picture 54", Description = "RADAR_Opinion_BNR" };
Pic.NonVisualPictureDrawingProperties nonVisualPictureDrawingProperties12 = new Pic.NonVisualPictureDrawingProperties();
A.PictureLocks pictureLocks12 = new A.PictureLocks() { NoChangeAspect = true, NoChangeArrowheads = true };
nonVisualPictureDrawingProperties12.Append(pictureLocks12);
nonVisualPictureProperties12.Append(nonVisualDrawingProperties12);
nonVisualPictureProperties12.Append(nonVisualPictureDrawingProperties12);
Pic.BlipFill blipFill12 = new Pic.BlipFill();
A.Blip blip12 = new A.Blip() { Embed = "rId1" };
A.SourceRectangle sourceRectangle12 = new A.SourceRectangle();
A.Stretch stretch12 = new A.Stretch();
A.FillRectangle fillRectangle12 = new A.FillRectangle();
stretch12.Append(fillRectangle12);
blipFill12.Append(blip12);
blipFill12.Append(sourceRectangle12);
blipFill12.Append(stretch12);
Pic.ShapeProperties shapeProperties12 = new Pic.ShapeProperties() { BlackWhiteMode = A.BlackWhiteModeValues.Auto };
A.Transform2D transform2D12 = new A.Transform2D();
A.Offset offset12 = new A.Offset() { X = 0L, Y = 0L };
A.Extents extents12 = new A.Extents() { Cx = 6858000L, Cy = 714375L };
//.........这里部分代码省略.........
示例9: GenerateHeaderPart2Content
// Generates content of headerPart2.
private void GenerateHeaderPart2Content(HeaderPart headerPart2)
{
Header header2 = new Header() {MCAttributes = new MarkupCompatibilityAttributes() {Ignorable = "w14 wp14"}};
header2.AddNamespaceDeclaration("wpc", "http://schemas.microsoft.com/office/word/2010/wordprocessingCanvas");
header2.AddNamespaceDeclaration("mc", "http://schemas.openxmlformats.org/markup-compatibility/2006");
header2.AddNamespaceDeclaration("o", "urn:schemas-microsoft-com:office:office");
header2.AddNamespaceDeclaration("r", "http://schemas.openxmlformats.org/officeDocument/2006/relationships");
header2.AddNamespaceDeclaration("m", "http://schemas.openxmlformats.org/officeDocument/2006/math");
header2.AddNamespaceDeclaration("v", "urn:schemas-microsoft-com:vml");
header2.AddNamespaceDeclaration("wp14", "http://schemas.microsoft.com/office/word/2010/wordprocessingDrawing");
header2.AddNamespaceDeclaration("wp", "http://schemas.openxmlformats.org/drawingml/2006/wordprocessingDrawing");
header2.AddNamespaceDeclaration("w10", "urn:schemas-microsoft-com:office:word");
header2.AddNamespaceDeclaration("w", "http://schemas.openxmlformats.org/wordprocessingml/2006/main");
header2.AddNamespaceDeclaration("w14", "http://schemas.microsoft.com/office/word/2010/wordml");
header2.AddNamespaceDeclaration("wpg", "http://schemas.microsoft.com/office/word/2010/wordprocessingGroup");
header2.AddNamespaceDeclaration("wpi", "http://schemas.microsoft.com/office/word/2010/wordprocessingInk");
header2.AddNamespaceDeclaration("wne", "http://schemas.microsoft.com/office/word/2006/wordml");
header2.AddNamespaceDeclaration("wps", "http://schemas.microsoft.com/office/word/2010/wordprocessingShape");
Paragraph paragraph30 = new Paragraph() {RsidParagraphAddition = "0005059E", RsidRunAdditionDefault = "0005059E"};
ParagraphProperties paragraphProperties11 = new ParagraphProperties();
ParagraphStyleId paragraphStyleId5 = new ParagraphStyleId() {Val = "Header"};
paragraphProperties11.Append(paragraphStyleId5);
paragraph30.Append(paragraphProperties11);
Paragraph paragraph31 = new Paragraph() {RsidParagraphAddition = "0005059E", RsidRunAdditionDefault = "0005059E"};
ParagraphProperties paragraphProperties12 = new ParagraphProperties();
ParagraphStyleId paragraphStyleId6 = new ParagraphStyleId() {Val = "Header"};
paragraphProperties12.Append(paragraphStyleId6);
paragraph31.Append(paragraphProperties12);
header2.Append(paragraph30);
header2.Append(paragraph31);
headerPart2.Header = header2;
}
示例10: GenerateHeaderPart1Content
// Generates content of headerPart1.
private void GenerateHeaderPart1Content(HeaderPart headerPart1)
{
Header header1 = new Header() {MCAttributes = new MarkupCompatibilityAttributes() {Ignorable = "w14 wp14"}};
header1.AddNamespaceDeclaration("wpc", "http://schemas.microsoft.com/office/word/2010/wordprocessingCanvas");
header1.AddNamespaceDeclaration("mc", "http://schemas.openxmlformats.org/markup-compatibility/2006");
header1.AddNamespaceDeclaration("o", "urn:schemas-microsoft-com:office:office");
header1.AddNamespaceDeclaration("r", "http://schemas.openxmlformats.org/officeDocument/2006/relationships");
header1.AddNamespaceDeclaration("m", "http://schemas.openxmlformats.org/officeDocument/2006/math");
header1.AddNamespaceDeclaration("v", "urn:schemas-microsoft-com:vml");
header1.AddNamespaceDeclaration("wp14", "http://schemas.microsoft.com/office/word/2010/wordprocessingDrawing");
header1.AddNamespaceDeclaration("wp", "http://schemas.openxmlformats.org/drawingml/2006/wordprocessingDrawing");
header1.AddNamespaceDeclaration("w10", "urn:schemas-microsoft-com:office:word");
header1.AddNamespaceDeclaration("w", "http://schemas.openxmlformats.org/wordprocessingml/2006/main");
header1.AddNamespaceDeclaration("w14", "http://schemas.microsoft.com/office/word/2010/wordml");
header1.AddNamespaceDeclaration("wpg", "http://schemas.microsoft.com/office/word/2010/wordprocessingGroup");
header1.AddNamespaceDeclaration("wpi", "http://schemas.microsoft.com/office/word/2010/wordprocessingInk");
header1.AddNamespaceDeclaration("wne", "http://schemas.microsoft.com/office/word/2006/wordml");
header1.AddNamespaceDeclaration("wps", "http://schemas.microsoft.com/office/word/2010/wordprocessingShape");
Paragraph paragraph27 = new Paragraph()
{
RsidParagraphMarkRevision = "00442AD3",
RsidParagraphAddition = "0005059E",
RsidParagraphProperties = "00442AD3",
RsidRunAdditionDefault = "0005059E"
};
ParagraphProperties paragraphProperties8 = new ParagraphProperties();
ParagraphStyleId paragraphStyleId2 = new ParagraphStyleId() {Val = "Title"};
ParagraphMarkRunProperties paragraphMarkRunProperties2 = new ParagraphMarkRunProperties();
RunStyle runStyle1 = new RunStyle() {Val = "Strong"};
paragraphMarkRunProperties2.Append(runStyle1);
paragraphProperties8.Append(paragraphStyleId2);
paragraphProperties8.Append(paragraphMarkRunProperties2);
Run run43 = new Run();
Text text28 = new Text();
text28.Text = "Class name here";
run43.Append(text28);
paragraph27.Append(paragraphProperties8);
paragraph27.Append(run43);
header1.Append(paragraph27);
headerPart1.Header = header1;
}
示例11: GenerateHeaderPart1Content
// Generates content of headerPart1.
private void GenerateHeaderPart1Content(HeaderPart headerPart1)
{
Header header1 = new Header() { MCAttributes = new MarkupCompatibilityAttributes() { Ignorable = "w14 wp14" } };
header1.AddNamespaceDeclaration("wpc", "http://schemas.microsoft.com/office/word/2010/wordprocessingCanvas");
header1.AddNamespaceDeclaration("mc", "http://schemas.openxmlformats.org/markup-compatibility/2006");
header1.AddNamespaceDeclaration("o", "urn:schemas-microsoft-com:office:office");
header1.AddNamespaceDeclaration("r", "http://schemas.openxmlformats.org/officeDocument/2006/relationships");
header1.AddNamespaceDeclaration("m", "http://schemas.openxmlformats.org/officeDocument/2006/math");
header1.AddNamespaceDeclaration("v", "urn:schemas-microsoft-com:vml");
header1.AddNamespaceDeclaration("wp14", "http://schemas.microsoft.com/office/word/2010/wordprocessingDrawing");
header1.AddNamespaceDeclaration("wp", "http://schemas.openxmlformats.org/drawingml/2006/wordprocessingDrawing");
header1.AddNamespaceDeclaration("w10", "urn:schemas-microsoft-com:office:word");
header1.AddNamespaceDeclaration("w", "http://schemas.openxmlformats.org/wordprocessingml/2006/main");
header1.AddNamespaceDeclaration("w14", "http://schemas.microsoft.com/office/word/2010/wordml");
header1.AddNamespaceDeclaration("wpg", "http://schemas.microsoft.com/office/word/2010/wordprocessingGroup");
header1.AddNamespaceDeclaration("wpi", "http://schemas.microsoft.com/office/word/2010/wordprocessingInk");
header1.AddNamespaceDeclaration("wne", "http://schemas.microsoft.com/office/word/2006/wordml");
header1.AddNamespaceDeclaration("wps", "http://schemas.microsoft.com/office/word/2010/wordprocessingShape");
Paragraph paragraph113 = new Paragraph() { RsidParagraphAddition = "00963B42", RsidRunAdditionDefault = "00963B42" };
ParagraphProperties paragraphProperties65 = new ParagraphProperties();
ParagraphStyleId paragraphStyleId1 = new ParagraphStyleId() { Val = "Header" };
Justification justification10 = new Justification() { Val = JustificationValues.Right };
paragraphProperties65.Append(paragraphStyleId1);
paragraphProperties65.Append(justification10);
paragraph113.Append(paragraphProperties65);
Paragraph paragraph114 = new Paragraph() { RsidParagraphAddition = "00963B42", RsidRunAdditionDefault = "00963B42" };
ParagraphProperties paragraphProperties66 = new ParagraphProperties();
ParagraphStyleId paragraphStyleId2 = new ParagraphStyleId() { Val = "Header" };
paragraphProperties66.Append(paragraphStyleId2);
paragraph114.Append(paragraphProperties66);
header1.Append(paragraph113);
header1.Append(paragraph114);
headerPart1.Header = header1;
}
示例12: TestSimpleGroup
private void TestSimpleGroup(SdbSchemaDatas sdbSchemaDatas)
{
ValidationContext validationContext = new ValidationContext();
ValidationResult actual = new ValidationResult();
validationContext.ValidationErrorEventHandler += actual.OnValidationError;
OpenXmlElement errorChild;
Header header = new Header();
var expected = header;
var particleConstraint = sdbSchemaDatas.GetSchemaTypeData(header).ParticleConstraint;
// the complex type contains a <xsd:group .../> as child
var target = particleConstraint.ParticleValidator as GroupParticleValidator;
validationContext.Element = header;
//<xsd:complexType name="CT_HdrFtr">
// <xsd:group ref="EG_BlockLevelElts" minOccurs="1" maxOccurs="unbounded" />
//</xsd:complexType>
//<xs:group name="EG_BlockLevelElts">
// <xs:choice>
// <xs:group ref="EG_BlockLevelEltsBase" minOccurs="0" maxOccurs="unbounded" />
// <xs:group ref="EG_BlockLevelChunkElts" minOccurs="0" maxOccurs="unbounded" />
// </xs:choice>
//</xs:group>
//<xs:group name="EG_BlockLevelEltsBase">
// <xs:choice>
// <xs:element name="altChunk" type="CT_AltChunk" minOccurs="0" maxOccurs="unbounded"></xs:element>
// </xs:choice>
//</xs:group>
//<xsd:group name="EG_BlockLevelChunkElts">
// <xsd:choice>
// <xsd:group ref="EG_ContentBlockContent" minOccurs="0" maxOccurs="unbounded" />
// </xsd:choice>
//</xsd:group>
//<xs:group name="EG_ContentBlockContent">
// <xs:choice>
// <xs:group ref="EG_ContentBlockContentBase" minOccurs="0" maxOccurs="unbounded" />
// <xs:group ref="EG_RunLevelElts" minOccurs="0" maxOccurs="unbounded" />
// </xs:choice>
//</xs:group>
//<xs:group name="EG_ContentBlockContentBase">
// <xs:choice>
// <xs:element name="customXml" type="CT_CustomXmlBlock"></xs:element>
// <xs:element name="sdt" type="CT_SdtBlock"></xs:element>
// <xs:element name="p" type="CT_P" minOccurs="0" maxOccurs="unbounded"></xs:element>
// <xs:element name="tbl" type="CT_Tbl" minOccurs="0" maxOccurs="unbounded"></xs:element>
// </xs:choice>
//</xs:group>
// ***** good case ******
// empty is ok
target.Validate(validationContext);
Assert.True(actual.Valid);
// Paragraph is ok
header.Append(new Paragraph());
target.Validate(validationContext);
Assert.True(actual.Valid);
// Table is ok
header.Append(new Table());
target.Validate(validationContext);
Assert.True(actual.Valid);
// more Paragraph is ok
header.Append(new Paragraph());
target.Validate(validationContext);
Assert.True(actual.Valid);
// Sdt is ok
header.Append(new SdtBlock());
target.Validate(validationContext);
Assert.True(actual.Valid);
// altChunk is ok
header.Append(new AltChunk());
target.Validate(validationContext);
Assert.True(actual.Valid);
// altChunk is ok
header.Append(new AltChunk());
target.Validate(validationContext);
Assert.True(actual.Valid);
// more Paragraph is ok
header.Append(new Paragraph());
target.Validate(validationContext);
Assert.True(actual.Valid);
// ***** error case ******
//first is invalid
errorChild = header.PrependChild(new Run());
target.Validate(validationContext);
Assert.False(actual.Valid);
//.........这里部分代码省略.........