我使用Interop.Word
以编程方式为Word文档创建图表和目录表。
//Range where ToF will be located
Range rangeForTOCTOF = wordDoc.Range(0, 0);
//Create ToF
TableOfFigures tof = wordDoc.TablesOfFigures.Add(rangeForTOCTOF, ref missing, ref missing, ref missing, ref missing, ref missing, ref missing, ref missing, ref missing, ref missing, ref missing, ref missing);
wordDoc.TablesOfFigures[1].TabLeader = WdTabLeader.wdTabLeaderDots;
wordDoc.TablesOfFigures.Format = WdTofFormat.wdTOFFormal;
tof.Update();
如何设置ToF之上的标题,如“数字表”?
答案 0 :(得分:0)
您可以添加以下这一行:
rangeForTOCTOF.InsertBefore("Table of Figures\n");
或:
rangeForTOCTOF.InsertAfter("Table of Figures\n");