UNO Writer: Merging cells results in wrong column count from XTextTable

Grover Blue grover.blue at gmail.com
Thu Aug 28 12:35:08 PDT 2014


So, really, I want to grab all rows and find the max columns count among
them.


On Thu, Aug 28, 2014 at 2:56 PM, Michael Stahl <mstahl at redhat.com> wrote:

> On 28/08/14 20:43, Grover Blue wrote:
> > I have a Writer document with a table that has two rows and 5 columns.
> > When XTextTable is first created, xTextTable.getColumns().getCount()
> > returns the correct count of 5. When I merge 4 columns in the first row,
> > xTextTable.getColumns().getCount() then returns a count of 2. But that's
> > wrong, since row 2 has 5 columns.
> >
> >
> > Is this a bug?  If not, how to properly get the number of columns/rows
> > in a table?
>
> must be this function:
>
> > sal_Int32 SwXTableColumns::getCount(void) throw( uno::RuntimeException,
> std::exception )
> > {
> >    ...
> >         SwTable* pTable = SwTable::FindTable( pFrmFmt );
> >         if(!pTable->IsTblComplex())
> >         {
> >             SwTableLines& rLines = pTable->GetTabLines();
> >             SwTableLine* pLine = rLines.front();
> >             nRet = pLine->GetTabBoxes().size();
> >         }
> >     }
> >     return nRet;
> > }
>
> as you see it just counts the cells in the first row of the table, and
> calls that the number of columns...
>
> whether that is correct or not is arguable: in core Writer tables, there
> are actually no columns; there are just rows, and each rows contains
> some number of cells, and there's no requirement that there must be the
> same number of cells in each row; the columns in the API wrappers then
> somehow badly try to emulate columns on top of the core rows-and-cells
> data structure...
>



-- 
“If the American people ever allow private banks to control the issue of
their currency, first by inflation, then by deflation, the banks...will
deprive the people of all property until their children wake-up homeless on
the continent their fathers conquered... The issuing power should be taken
from the banks and restored to the people, to whom it properly belongs."
-- Thomas Jefferson

"Government big enough to supply everything...is big enough to take
everything you have. The course of history shows that as a government
grows, liberty decreases" --- Thomas Jefferson

www.CampaignForLiberty.org
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.freedesktop.org/archives/libreoffice/attachments/20140828/80c232c9/attachment.html>


More information about the LibreOffice mailing list