How to get a cell count of a column?
Hi All,
How to get a cell count of a column?
Regards,
Chinna
Hi All,
How to get a cell count of a column?
Regards,
Chinna
Sorry, checking IIDXMLElement is no good.
Remove (skip) kTextChar_ZeroSpaceNoBreak (xmltag mark) char in cell text.
// Have you resolved?
InterfacePtr<ITableTextContainer> tableTextContainer(tableModel, UseDefaultIID());
InterfacePtr<ITextModel> textModel(tableTextContainer->QueryTextModel());
InterfacePtr<IComposeScanner> composeScanner(textModel, UseDefaultIID());
InterfacePtr<ITextStoryThreadDict> textStoryThreadDict(tableModel, UseDefaultIID());
//int32 totalRowsCount = tableModel->GetTotalRows().count;
//int32 totalColsCount = tableModel->GetTotalCols().count;
ITableModel::const_iterator iterTable(tableModel->begin());
ITableModel::const_iterator end(tableModel->end());
while (iterTable != end) {
GridAddress gridAddress = *iterTable;
GridSpan gridSpan = tableModel->GetCellSpan(gridAddress);
GridArea gridArea(gridAddress, gridSpan);
const GridID gridID = tableModel->GetGridID(gridAddress);
InterfacePtr<ITextStoryThread> textStoryThread(textStoryThreadDict->QueryThread(gridID));
if (textStoryThread == nil) {
iterTable++;
continue;
}
TextIndex threadStart = 0;
int32 threadLength = -1;
threadStart = textStoryThread->GetTextStart(&threadLength);
int32 cellStrLength = threadLength - 1;
PMString cellStr;
if (cellStrLength > 0) {
WideString tempCopy;
composeScanner->CopyText(threadStart, cellStrLength, &tempCopy);
cellStr = PMString(tempCopy);
// remove kTextChar_ZeroSpaceNoBreak (xmltag mark)
for (int32 i=0; i<cellStrLength; i++) {
UTF32TextChar uniChar = cellStr.GetWChar(i);
if (uniChar == kTextChar_ZeroSpaceNoBreak) {
cellStr.Remove(i);
cellStrLength--;
i--;
}
}
}
//cellStrlength = cellStr.WCharLength();
PMString infoStr("row:");
infoStr.AppendNumber(gridAddress.row+1);
infoStr.Append(", col:");
infoStr.AppendNumber(gridAddress.col+1);
infoStr.Append(", rowSpan:");
infoStr.AppendNumber(gridArea.Height());
infoStr.Append(", colSpan:");
infoStr.AppendNumber(gridArea.Width());
infoStr.Append(", textLength:");
infoStr.AppendNumber(cellStrLength);
if (cellStrLength > 0) {
infoStr.Append(", text:");
infoStr.Append(cellStr);
}
CAlert::InformationAlert(infoStr);
iterTable++;
}
Already have an account? Login
Enter your E-mail address. We'll send you an e-mail with instructions to reset your password.