VC中设置word表格列宽的问题 最近用vc做报表,用的msword,引用其中的Table类来做了个表格,但是我不会设置表格的列宽,只能均匀分布,我已经引入了一个column类,但不知如何获取列,请各位指教一二,谢谢。 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 Table->Columns->Items(1)就是第一列 有谁用vc做过报表的请来指点下,可能的话写详细点,2楼的回复我看不懂,Table类和Columns类我都看了,感觉好像不沾边。 给你的我的程序中的代码看看: // 统计表 pTable = pDoc->Tables->Add(pRange, 2L, 5L); pTable->Borders->Enable = (long)wdLineStyleSingle; pTable->LeftPadding = pWord->MillimetersToPoints(0.5); pTable->RightPadding = pWord->MillimetersToPoints(0.5); pTable->Range->Cells->VerticalAlignment = wdCellAlignVerticalCenter; pRows = pTable->Rows; pRows->Alignment = wdAlignRowCenter; pRows->Item(1l)->HeadingFormat = (long)-1; // 列格式 // 第一列 pTable->Columns->Item(1L)->Width = pWord->MillimetersToPoints(20.0f); pRange = pTable->Cell(2, 1)->Range; pRange->Font->Name = L"Courier New"; pRange->Font->Size = 10.0f; pRange->ParagraphFormat->Alignment = wdAlignParagraphLeft; // 第二列 pTable->Columns->Item(2L)->Width = pWord->MillimetersToPoints(28.0f); pRange = pTable->Cell(2, 2)->Range; pRange->Font->Name = L"Courier New"; pRange->Font->Size = 10.0f; pRange->ParagraphFormat->Alignment = wdAlignParagraphLeft; 我是这样导入Word库的:#import "C:\Program Files\Microsoft Office\OFFICE11\MSWORD.OLB" auto_rename auto_search 关于vc中添加新类文件的问题 CTime问题 急!链接时发生错误!! visual studio 2005 命令行输出乱码。。。求救!!!! 如何利用SetTimer()和OnTimer函数实现字符的闪烁 unicode的问题 急急急!!!线程中的数据库指针!!! 急聘兼职多媒体开发工程师(VC) 关于dll编程的问题??? 如何使静态文本static控件上不同的区域显示不同的颜色? 用线程来备份SQLSERVER,如果是备份数据少的数据库,正常,如果备份3G的数据库,则提示备份失败! text-to-speech 控制中英文广阅读
pTable = pDoc->Tables->Add(pRange, 2L, 5L);
pTable->Borders->Enable = (long)wdLineStyleSingle;
pTable->LeftPadding = pWord->MillimetersToPoints(0.5);
pTable->RightPadding = pWord->MillimetersToPoints(0.5);
pTable->Range->Cells->VerticalAlignment = wdCellAlignVerticalCenter;
pRows = pTable->Rows;
pRows->Alignment = wdAlignRowCenter;
pRows->Item(1l)->HeadingFormat = (long)-1; // 列格式 // 第一列
pTable->Columns->Item(1L)->Width = pWord->MillimetersToPoints(20.0f);
pRange = pTable->Cell(2, 1)->Range;
pRange->Font->Name = L"Courier New";
pRange->Font->Size = 10.0f;
pRange->ParagraphFormat->Alignment = wdAlignParagraphLeft;
// 第二列
pTable->Columns->Item(2L)->Width = pWord->MillimetersToPoints(28.0f);
pRange = pTable->Cell(2, 2)->Range;
pRange->Font->Name = L"Courier New";
pRange->Font->Size = 10.0f;
pRange->ParagraphFormat->Alignment = wdAlignParagraphLeft;
#import "C:\Program Files\Microsoft Office\OFFICE11\MSWORD.OLB" auto_rename auto_search