如何将书签导入microsoft edge

我没有用图片试过!

下面是关键代码,但它只生成文本!

希望对你有用。

添加引用:

使用微软。Office . Interop.Word

//============================

私有不安全void ThreadWork()

{

尝试

{

这个。SetBtnDisable();

String str = "数据库名称:"+this . dbname;

int count = this . list table 2 . items . count;

这个。SetprogressBar1Max(计数);

这个。setprogressbar 1 val(1);

这个。SetlblStatuText(" 0 ");

对象模板=缺失。价值;

object obj3 = @ " \ endofdoc

Microsoft . office . interop . word . _ Application Application =新微软。office . interop . word . application class();

申请。可见=假;

Microsoft . office . interop . word . _ Document文档=应用程序。单据.添加(参照模板,参照模板,参照模板,参照模板);

申请。active window . view . type = Microsoft。office . interop . word . wdviewtype . wdoutlineview;

申请。active window . view . seek view = Microsoft。office . interop . word . wdseekview . wdseekprimaryheader;

application . active window . active pane . selection . inserter("导出到Word ");

申请。selection . paragraph format . alignment = Microsoft。office . interop . word . wdparagraphalignment . wdalignparagraphright;

申请。active window . view . seek view = Microsoft。office . interop . word . wdseekview . wdseekmaindocument;

微软。office . interop . word . paragraph paragraph = document。Content.Paragraphs.Add(参考模板);

段落。Range . Text = str

段落。range . font . bold = 1;

段落。range . font . name = "ì";

段落。range . font . size = 12f;

段落。range . paragraph format . alignment = Microsoft。office . interop . word . wdparagraphalignment . wdalignparagraphcenter;

段落。Format . SpaceAfter = 5f

段落。range . InsertParagraphAfter();

for(int I = 0;我& lt数数;i++)

{

string tableName = this . list table 2 . items[I]。ToString();

string str 3 = " Table name:"+tableName;

列表& ltColumnInfo & gtcolumnInfoList = this . db obj . getcolumninfolist(this . dbname,tableName);

int num3 = columnInfoList。数数;

如果((columnInfoList!= null)& amp;& amp(columnInfoList。Count & gt0))

{

对象obj4 =文档。Bookmarks.get_Item(ref obj3)。范围;

微软。office . interop . word . paragraph paragraph 2 =文档。内容.段落.添加(参考obj 4);

第2段。Range . Text = str3

第2段。range . font . bold = 1;

第2段。range . font . name = "ì";

第2段。range . font . size = 10f;

第2段。range . paragraph format . alignment = Microsoft。office . interop . word . wdparagraphalignment . wdalignparagraphcenter;

第2段。format . space before = 15f;

第2段。format . space after = 1f;

第2段。range . InsertParagraphAfter();

obj4 =文档。Bookmarks.get_Item(ref obj3)。范围;

微软。office . interop . word . paragraph paragraph 3 =文档。内容.段落.添加(参考obj 4);

第3段。Range . Text =

第3段。range . font . bold = 0;

第3段。Range.Font.Name = "宋体";

第3段。Range . Font.Size = 9f

第3段。range . paragraph format . alignment = Microsoft。office . interop . word . wdparagraphalignment . wdalignparagraphcenter;

第3段。format . space before = 1f;

第3段。format . space after = 1f;

第3段。range . InsertParagraphAfter();

微软。Office.Interop.Word.Range范围=文档。Bookmarks.get_Item(ref obj3)。范围;

微软。Office.Interop.Word.Table表格=文档。Tables.Add(range,num3 + 1,10,ref模板,ref模板);

桌子。range . font . name = "ì";

桌子。Range . Font.Size = 9f

桌子。borders . Enable = 1;

桌子。rows . Height = 10f;

桌子。AllowAutoFit = true

Table.cell (1,1)。range.text = "序列号";

Table.cell (1,2)。range.text = "列名";

Table.cell (1,3)。range.text = "数据类型";

Table.cell (1,4)。range.text = " length

Table.cell (1,5)。range.text = "小数位数";

Table.cell (1,6)。range.text = " logo

Table.cell (1,7)。range.text = " primary key

Table.cell (1,8)。range.text = "允许空白";

Table.cell (1,9)。range.text = "默认值";

Table.cell (1,10)。range.text = " Description

桌子。列[1]。宽度= 33f

桌子。列[3]。宽度= 60f

桌子。列[4]。宽度= 33f

桌子。列[5]。宽度= 43f

桌子。列[6]。宽度= 33f

桌子。列[7]。宽度= 33f

桌子。列[8]。宽度= 43f

for(int j = 0;j & ltnum3j++)

{

column info info = column infolist[j];

string colorder = info。Colorder

字符串columnName = info。ColumnName

字符串类型名=信息。键入名称;

字符串长度=信息。长度;

字符串scale = info。规模;

string str9 = (info。IsIdentity.ToString()。ToLower() == "true ")?“是”:“;

string str10 =(信息。IsPK.ToString()。ToLower() == "true ")?“是”:“;

string str 11 =(info . cisnull . tostring()。ToLower() == "true ")?“是”:“不是”;

字符串str12 = info。default val . ToString();

字符串str13 = info。DeText . ToString();

如果(长度。Trim() == "-1 ")

{

length = " MAX

}

桌子。Cell(j + 2,1). range . text = colorder;

桌子。Cell(j + 2,2). range . text = column name;

桌子。Cell(j + 2,3). range . text = typeName;

桌子。Cell(j + 2,4). range . text = length;

桌子。Cell(j + 2,5). range . text = scale;

桌子。Cell(j + 2,6). range . text = str 9;

桌子。Cell(j + 2,7). range . text = str 10;

桌子。Cell(j + 2,8). range . text = str 11;

桌子。Cell(j + 2,9). range . text = str 12;

桌子。Cell(j + 2,10). range . text = str 13;

}

桌子。rows[1]. range . font . bold = 1;

桌子。rows[1]. range . paragraph format . alignment = Microsoft。office . interop . word . wdparagraphalignment . wdalignparagraphcenter;

桌子。rows . first . shading . texture = Microsoft。office . interop . word . wdtextureindex . wdtexture 25 percent;

}

这个。setprogressbar 1 val(I+1);

这个。SetlblStatuText((i + 1)。ToString());

}

申请。可见=真;

文档。activate();

这个。SetBtnEnable();

MessageBox。显示("单据生成成功!",“完成”,messageboxbuttons.ok,messagebox icon . asterisk);

}

catch(异常异常)

{

LogInfo。WriteLog(异常);

MessageBox。Show("文档生成失败!("+异常。消息+”).\ r \请关闭它,然后再试一次。,“prompt”,messageboxbuttons.ok,messagebox icon . explanation);

}

}