组建对象ITextSelection如何插入一行
并对该行付上固定文字下面代码
//lTopLine 为选中的第一行的行号
//lBottomLine 为选中的最后一行的行号
难点如何在lTopLine行前插入一行特定数据的文本for(long iCount=lTopLine;iCount<=lBottomLine;iCount++)
{
// TextSelect->NewLine; ???
TextSelect->MoveTo(iCount,1,v);
TextSelect->get_Text(&tmpBSTR);
tmpStr=tmpBSTR;
tmpStr=_T("//")+tmpStr;
if(iCount==lTopLine)
{
TextSelect->MoveTo(iCount,1,v);
TextSelect->put_Text(tmpStr.AllocSysString());
TextSelect->MoveTo(iCount,0,v);
tmpStr=tmpStr+_T("Modified By vabug ")+strDate+_T(" Begin");
}
if(iCount==lBottomLine)
{
TextSelect->MoveTo(iCount,1,v);
TextSelect->put_Text(tmpStr.AllocSysString());
TextSelect->MoveTo(iCount,0,v);
tmpStr=tmpStr+_T("Modified By vabug ")+strDate+_T(" End");
}
TextSelect->put_Text(tmpStr.AllocSysString());
}
并对该行付上固定文字下面代码
//lTopLine 为选中的第一行的行号
//lBottomLine 为选中的最后一行的行号
难点如何在lTopLine行前插入一行特定数据的文本for(long iCount=lTopLine;iCount<=lBottomLine;iCount++)
{
// TextSelect->NewLine; ???
TextSelect->MoveTo(iCount,1,v);
TextSelect->get_Text(&tmpBSTR);
tmpStr=tmpBSTR;
tmpStr=_T("//")+tmpStr;
if(iCount==lTopLine)
{
TextSelect->MoveTo(iCount,1,v);
TextSelect->put_Text(tmpStr.AllocSysString());
TextSelect->MoveTo(iCount,0,v);
tmpStr=tmpStr+_T("Modified By vabug ")+strDate+_T(" Begin");
}
if(iCount==lBottomLine)
{
TextSelect->MoveTo(iCount,1,v);
TextSelect->put_Text(tmpStr.AllocSysString());
TextSelect->MoveTo(iCount,0,v);
tmpStr=tmpStr+_T("Modified By vabug ")+strDate+_T(" End");
}
TextSelect->put_Text(tmpStr.AllocSysString());
}
能对选中的文本进行操作,
可我不知道如何插入一行固定文本的方法,
欢迎讨论!