本文整理汇总了C++中CRange::get_EntireColumn方法的典型用法代码示例。如果您正苦于以下问题:C++ CRange::get_EntireColumn方法的具体用法?C++ CRange::get_EntireColumn怎么用?C++ CRange::get_EntireColumn使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CRange
的用法示例。
在下文中一共展示了CRange::get_EntireColumn方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。
示例1: Lin_ExportListToExcel
void COpenExcelDlg::Lin_ExportListToExcel(CListCtrl &m_List)
{
if (m_List.GetHeaderCtrl()->GetItemCount()>0)
{
CApplication app;
CWorkbooks books;
CWorkbook book;
CWorksheets sheets;
CWorksheet sheet;
CRange range;
CRange cols;
int i = 3;
CString str1, str2;
COleVariant covOptional((long)DISP_E_PARAMNOTFOUND, VT_ERROR);
if( !app.CreateDispatch(_T("Excel.Application")))
{
MessageBox(_T("无法创建Excel应用!"));
return;
}
books=app.get_Workbooks();
book=books.Add(covOptional);
sheets=book.get_Sheets();
sheet=sheets.get_Item(COleVariant((short)1));
//写入表头//
for (int ColumNum=1;ColumNum<m_List.GetHeaderCtrl()->GetItemCount();ColumNum++)
{
str2 = Lin_GetEnglishCharacter(ColumNum);
str2 = str2 + _T("1");
LVCOLUMN lvColumn;
TCHAR strChar[256];
lvColumn.pszText=strChar;
lvColumn.cchTextMax=256 ;
lvColumn.mask = LVCF_TEXT;
m_List.GetColumn(ColumNum,&lvColumn);
CString str=lvColumn.pszText;
range=sheet.get_Range(COleVariant(str2),COleVariant(str2));
range.put_Value2(COleVariant(str));
}
//获取单元格的位置//
for (int ColumNum =1;ColumNum<m_List.GetHeaderCtrl()->GetItemCount();ColumNum++)
{
for (int ItemNum = 0;ItemNum<m_List.GetItemCount();ItemNum++)
{
str2 = Lin_GetEnglishCharacter(ColumNum);
str1.Format(_T("%d"),ItemNum+2);
str2 = str2+str1;
CString str = m_List.GetItemText(ItemNum,ColumNum);
range=sheet.get_Range(COleVariant(str2),COleVariant(str2));
range.put_Value2(COleVariant(str));
}
}
cols=range.get_EntireColumn();
cols.AutoFit();
app.put_Visible(TRUE);
app.put_UserControl(TRUE);
}else{
AfxMessageBox(_T("列表为空"));
}
}
开发者ID:ShelmyLin,项目名称:whu_VoiceCard,代码行数:64,代码来源:OpenExcelDlg.cpp示例2: Lin_ExportForArrToExcel
void Cwhu_FaxSettingDlg::Lin_ExportForArrToExcel(CStringArray &m_AutoForward,CString m_FilePath)
{
CApplication app;
CWorkbooks books;
CWorkbook book;
CWorksheets sheets;
CWorksheet sheet;
CRange range;
CRange cols;
CString str1, str2;
int m_ArrPos = 0;
int m_ArrCount = m_AutoForward.GetSize();
COleVariant covOptional((long)DISP_E_PARAMNOTFOUND, VT_ERROR);
if( !app.CreateDispatch(_T("Excel.Application")))
{
MessageBox(_T("无法创建Excel应用!"));
return;
}
books=app.get_Workbooks();
book=books.Add(covOptional);
sheets=book.get_Sheets();
sheet=sheets.get_Item(COleVariant((short)1));
//写入表头//
str2 = _T("A1");
CString str = _T("源号码");
range=sheet.get_Range(COleVariant(str2),COleVariant(str2));
range.put_Value2(COleVariant(str));
str2 = _T("B1");
str = _T("转发号码个数");
range=sheet.get_Range(COleVariant(str2),COleVariant(str2));
range.put_Value2(COleVariant(str));
for (int j=3;j<11;j++)
{
str2 = Lin_GetEnglishCharacter(j);
str2 = str2 +_T("1");
str= _T("转发号码");
range=sheet.get_Range(COleVariant(str2),COleVariant(str2));
range.put_Value2(COleVariant(str));
}
CStringArray m_LineStart;
for (int i=0;i<m_ArrCount;i++)
{
CString m_str= m_AutoForward.GetAt(i);
int CharCount = m_str.GetLength();
if (CharCount<4) //如果是号码个数//
{
m_str.Format(_T("%d"),i-1);
m_LineStart.Add(m_str);
}
}
int ItemNum = 2;
int ColumNum = 1;
for (int i=0;i<m_LineStart.GetSize();i++)
{
int Pos = _ttoi(m_LineStart.GetAt(i));
CString m_str = m_AutoForward.GetAt(Pos+1);
int Number = _ttoi(m_str);
for (int j=0;j<Number+2;j++)
{
str2 = Lin_GetEnglishCharacter(ColumNum);
str1.Format(_T("%d"),ItemNum);
str2 = str2 +str1;
CString content = _T("'")+m_AutoForward.GetAt(Pos+j);
range=sheet.get_Range(COleVariant(str2),COleVariant(str2));
range.put_Value2(COleVariant(content));
ColumNum++;
if (ColumNum>10)
{
ColumNum = 3;
ItemNum++;
}
}
ItemNum++;
ColumNum = 1;
}
cols=range.get_EntireColumn();
cols.AutoFit();
//app.put_Visible(TRUE);
//app.put_UserControl(TRUE);
book.SaveAs(COleVariant(m_FilePath),covOptional,covOptional,covOptional,covOptional,covOptional,0,covOptional,covOptional,covOptional,covOptional,covOptional);
app.Quit();
}
开发者ID:ShelmyLin,项目名称:whu_VoiceCard,代码行数:88,代码来源:Cwhu_FaxSettingDlg.cpp本文标签属性:
示例:示例英语
代码:代码转换器
CRange:CRange
get_EntireColumn:get_EntireColumn