OWC Spreadsheet: SplitRow / FreezePanes problem

F

Florian Kock

Hi again!

I ran into another problem with the spreadsheet. I'm using the COM
interface, encapsulated by Qt. Therefore, I can't use any managed
extensions, MFC or VBA. It is all in C++.

Now, I want to make the first column and the first row fixed, so that they
are always visible, regardless of how much the user scrolls.
In VBA, I found a nice little method (or better, two). The first one is
SplitColumn (and SplitRow respectively), which splits the pane at the given
index. After calling both methods, it is then possible to call FreezePanes
and the table behaves exactly as I wanted.
But when I tried to do the same in C++, I couldn't find a method like
SplitRow. So I'm wondering, is there such a method that is exposed by the
interface?

However, I discovered that FreezePanes takes an argument that indicates
where the splitter shall be positioned. It is the enum SheetFreezePanesEnum,
which has values for top, bottom, left, right and none (while right and
bottom are marked to be for future use).
The problem is: After the first call of the method (to split the column),
the pane is already fixed, and I can't get it to split again so that the
row, too, is fixed. I tried to 'OR ' the argument with the values of left
and top, but it wouldn't work.

So my question is: how can I split the Columns AND the Rows and fix them?

Any help is greatly appreciated!

Greetings,
Florian Kock
 
A

Alvin Bruney [MVP]

Another approach is just to set the current selection on a cell where you
want the split to occur, then you call freezepane. By default, the pane will
freeze on that cell.
 
F

Florian Kock

Hello!

Thanks for your reply!

But how do I call FreezePanes on a single cell? The method takes an argument
that tells it where to set the splitter. The documentation says, there are
only these values:
ssFreezeLeft
ssFreezeRight (for future use)
ssFreezeTop
ssFreezeBottom (for future use)
ssFreezeNone
So what value am I supposed to take? Or is it possible to call that method
without giving a value?

Best regards,
Florian Kock

Alvin Bruney said:
Another approach is just to set the current selection on a cell where you
want the split to occur, then you call freezepane. By default, the pane will
freeze on that cell.

--
Regards,
Alvin Bruney
[ASP.NET MVP http://mvp.support.microsoft.com/default.aspx]
Got tidbits? Get it here... http://tinyurl.com/27cok
Florian Kock said:
Hi again!

I ran into another problem with the spreadsheet. I'm using the COM
interface, encapsulated by Qt. Therefore, I can't use any managed
extensions, MFC or VBA. It is all in C++.

Now, I want to make the first column and the first row fixed, so that they
are always visible, regardless of how much the user scrolls.
In VBA, I found a nice little method (or better, two). The first one is
SplitColumn (and SplitRow respectively), which splits the pane at the
given
index. After calling both methods, it is then possible to call FreezePanes
and the table behaves exactly as I wanted.
But when I tried to do the same in C++, I couldn't find a method like
SplitRow. So I'm wondering, is there such a method that is exposed by the
interface?

However, I discovered that FreezePanes takes an argument that indicates
where the splitter shall be positioned. It is the enum
SheetFreezePanesEnum,
which has values for top, bottom, left, right and none (while right and
bottom are marked to be for future use).
The problem is: After the first call of the method (to split the column),
the pane is already fixed, and I can't get it to split again so that the
row, too, is fixed. I tried to 'OR ' the argument with the values of left
and top, but it wouldn't work.

So my question is: how can I split the Columns AND the Rows and fix them?

Any help is greatly appreciated!

Greetings,
Florian Kock
 
F

Florian Kock

I have tried to call FreezePane on the specified cell ("B2"), and I
have also tried to call FreezePane without providing any arguments.
While the latter didn't work at all (as expected), the first call only
worked with ssFreezeLeft as the argument.
The documentation says that it is also possible to use ssFreezeTop
(which works fine in Excel and VBA makros), but if called from C++, it
seems to have no effect.
Am I missing something here?

Or is FreezePanes affected by cells (or rows/columns) that are already
filled, or are yet empty, respectively?

Best regards,
Florian Kock


Alvin Bruney said:
Another approach is just to set the current selection on a cell where you
want the split to occur, then you call freezepane. By default, the pane will
freeze on that cell.

--
Regards,
Alvin Bruney
[ASP.NET MVP http://mvp.support.microsoft.com/default.aspx]
Got tidbits? Get it here... http://tinyurl.com/27cok
Florian Kock said:
Hi again!

I ran into another problem with the spreadsheet. I'm using the COM
interface, encapsulated by Qt. Therefore, I can't use any managed
extensions, MFC or VBA. It is all in C++.

Now, I want to make the first column and the first row fixed, so that they
are always visible, regardless of how much the user scrolls.
In VBA, I found a nice little method (or better, two). The first one is
SplitColumn (and SplitRow respectively), which splits the pane at the
given
index. After calling both methods, it is then possible to call FreezePanes
and the table behaves exactly as I wanted.
But when I tried to do the same in C++, I couldn't find a method like
SplitRow. So I'm wondering, is there such a method that is exposed by the
interface?

However, I discovered that FreezePanes takes an argument that indicates
where the splitter shall be positioned. It is the enum
SheetFreezePanesEnum,
which has values for top, bottom, left, right and none (while right and
bottom are marked to be for future use).
The problem is: After the first call of the method (to split the column),
the pane is already fixed, and I can't get it to split again so that the
row, too, is fixed. I tried to 'OR ' the argument with the values of left
and top, but it wouldn't work.

So my question is: how can I split the Columns AND the Rows and fix them?

Any help is greatly appreciated!

Greetings,
Florian Kock
 
A

Alvin Bruney [MVP]

jeez, i'm not looking forward to probing that C++ code but
post your code and i'll take a look.

--
Regards,
Alvin Bruney
[ASP.NET MVP http://mvp.support.microsoft.com/default.aspx]
Got tidbits? Get it here... http://tinyurl.com/27cok
Florian Kock said:
I have tried to call FreezePane on the specified cell ("B2"), and I
have also tried to call FreezePane without providing any arguments.
While the latter didn't work at all (as expected), the first call only
worked with ssFreezeLeft as the argument.
The documentation says that it is also possible to use ssFreezeTop
(which works fine in Excel and VBA makros), but if called from C++, it
seems to have no effect.
Am I missing something here?

Or is FreezePanes affected by cells (or rows/columns) that are already
filled, or are yet empty, respectively?

Best regards,
Florian Kock


Alvin Bruney said:
Another approach is just to set the current selection on a cell where you
want the split to occur, then you call freezepane. By default, the pane
will
freeze on that cell.

--
Regards,
Alvin Bruney
[ASP.NET MVP http://mvp.support.microsoft.com/default.aspx]
Got tidbits? Get it here... http://tinyurl.com/27cok
Florian Kock said:
Hi again!

I ran into another problem with the spreadsheet. I'm using the COM
interface, encapsulated by Qt. Therefore, I can't use any managed
extensions, MFC or VBA. It is all in C++.

Now, I want to make the first column and the first row fixed, so that
they
are always visible, regardless of how much the user scrolls.
In VBA, I found a nice little method (or better, two). The first one is
SplitColumn (and SplitRow respectively), which splits the pane at the
given
index. After calling both methods, it is then possible to call
FreezePanes
and the table behaves exactly as I wanted.
But when I tried to do the same in C++, I couldn't find a method like
SplitRow. So I'm wondering, is there such a method that is exposed by
the
interface?

However, I discovered that FreezePanes takes an argument that indicates
where the splitter shall be positioned. It is the enum
SheetFreezePanesEnum,
which has values for top, bottom, left, right and none (while right and
bottom are marked to be for future use).
The problem is: After the first call of the method (to split the
column),
the pane is already fixed, and I can't get it to split again so that
the
row, too, is fixed. I tried to 'OR ' the argument with the values of
left
and top, but it wouldn't work.

So my question is: how can I split the Columns AND the Rows and fix
them?

Any help is greatly appreciated!

Greetings,
Florian Kock
 
F

Florian Kock

Since I'm using Qt, which encapsulates the COM interface, I don't know if
the code will be of much use, but I will post it anyway.
While searching through google groups, I found a thread between you and
Miranda Jones, from 16th April 2003 to 1st May 2003. Miranda had almost the
same problem as I have. The only difference is that she was using C# and is
trying to change the FreezePanes property of ActiveWindow.
I, on the other hand, don't have access to ActiveWindow through the
Qt-classes. The "highest" object I can call is ActiveSheet().
Unfortunately, she gave up and used an XML file to set the spreadsheet. So
maybe you want to have a look at that thread. It had the subject "OWC10 -
Problem setting Excel FreezePanes property.

Here now the code snippets:

//I can't call "ActiveWindow()". If I would do it, I would get a NULL
pointer...
QAxObject* pActiveSheet =
pQSpreadsheetWidget->querySubObject("ActiveSheet()");
//get the range "B2" and activate the cell.
QAxObject* pRange = pActiveSheet->querySubObject("Range(const QVariant&)",
"B2");
pRange->dynamicCall("Activate()");

// I _must_ provide an argument, but it splits the pane only vertically.
ssFreezeLeft == 1
pRange->dynamicCall("FreezePanes(SheetFreezePanesEnum)", 1);

//If I try to split it horizontally too, nothing happens. ssFreezeTop == 4
pRange->dynamicCall("FreezePanes(SheetFreezePanesEnum)", 4);

Hope you can find something! :)

Best regards,
Florian Kock


Alvin Bruney said:
jeez, i'm not looking forward to probing that C++ code but
post your code and i'll take a look.

--
Regards,
Alvin Bruney
[ASP.NET MVP http://mvp.support.microsoft.com/default.aspx]
Got tidbits? Get it here... http://tinyurl.com/27cok
Florian Kock said:
I have tried to call FreezePane on the specified cell ("B2"), and I
have also tried to call FreezePane without providing any arguments.
While the latter didn't work at all (as expected), the first call only
worked with ssFreezeLeft as the argument.
The documentation says that it is also possible to use ssFreezeTop
(which works fine in Excel and VBA makros), but if called from C++, it
seems to have no effect.
Am I missing something here?

Or is FreezePanes affected by cells (or rows/columns) that are already
filled, or are yet empty, respectively?

Best regards,
Florian Kock


Alvin Bruney said:
Another approach is just to set the current selection on a cell where you
want the split to occur, then you call freezepane. By default, the pane
will
freeze on that cell.

--
Regards,
Alvin Bruney
[ASP.NET MVP http://mvp.support.microsoft.com/default.aspx]
Got tidbits? Get it here... http://tinyurl.com/27cok
Hi again!

I ran into another problem with the spreadsheet. I'm using the COM
interface, encapsulated by Qt. Therefore, I can't use any managed
extensions, MFC or VBA. It is all in C++.

Now, I want to make the first column and the first row fixed, so that
they
are always visible, regardless of how much the user scrolls.
In VBA, I found a nice little method (or better, two). The first one is
SplitColumn (and SplitRow respectively), which splits the pane at the
given
index. After calling both methods, it is then possible to call
FreezePanes
and the table behaves exactly as I wanted.
But when I tried to do the same in C++, I couldn't find a method like
SplitRow. So I'm wondering, is there such a method that is exposed by
the
interface?

However, I discovered that FreezePanes takes an argument that indicates
where the splitter shall be positioned. It is the enum
SheetFreezePanesEnum,
which has values for top, bottom, left, right and none (while right and
bottom are marked to be for future use).
The problem is: After the first call of the method (to split the
column),
the pane is already fixed, and I can't get it to split again so that
the
row, too, is fixed. I tried to 'OR ' the argument with the values of
left
and top, but it wouldn't work.

So my question is: how can I split the Columns AND the Rows and fix
them?

Any help is greatly appreciated!

Greetings,
Florian Kock
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top