私の目標の目標と要件:ページへの絵、0にページ罫線は、(button1UseDocX_Click機能)を達成するために、次のコードを使用して、結果のドキュメントには、自分の目標を達成することはできません。button1UseSpireDoc_Click機能の目的を達成することができ、使用するSpire.Doc。
その理由は、ライブラリファイルが大きすぎる。スパイアので、DOCXを使用するが、これはほとんどの機能は、それが必要である30以上のM.
プライベート無効button1UseDocX_Click(オブジェクト送信者、EventArgsの電子)
{
//ドキュメントを作成します。
文字列filename = "_加页码の.docx"。
使用(DOCX文書= DocX.Create(ファイル名+ "_TEST.docx"))
{
document.InsertSection()。
;
//document.InsertSection()。
//ディスクからの単純な画像を追加します。
//document.PageWidth = 595。
//document.PageHeight = 842。
document.MarginBottom = 0;
document.MarginFooter = 0;
document.MarginHeader = 0;
document.MarginLeft = 0;
document.MarginRight = 0;
document.MarginTop = 0;
VAR画像= document.AddImage( "test1.jpg")。
VARピクチャ= image.CreatePicture((INT)document.PageHeight、(INT)document.PageWidth)。
VARのP = document.InsertParagraph()。
p.AppendPicture(画像)
document.Save();
}
プライベート無効button1UseSpireDoc_Click(オブジェクト送信者、EventArgsの電子)
{
文字列filename = "_输出の.docx"。
// wordDocx = DocX.Create(ファイル名);
文書ドキュメント=新しいドキュメント();
//は、絵のように背景の種類を設定します。
document.Background.Type = Spire.Doc.Documents.BackgroundType.Picture。
Spire.Doc.Section S = document.AddSection()。
s.PageSetup.PageSize = Spire.Doc.Documents.PageSize.A4。
s.PageSetup.Margins.All = 0;
Spire.Doc.Documents.Paragraph P = s.AddParagraph()。
DocPictureピック= p.AppendPicture(System.Drawing.Image.FromFile(imagefilename))。
Pic.Width = s.PageSetup.PageSize.Width。
Pic.Height = s.PageSetup.PageSize.Height。
//保存して起動
document.SaveToFile(ファイル名、FileFormat.Docx)。
System.Diagnostics.Process.Start(ファイル名);
}