FYI: Freezepanes sample ASP code for the OWC Spreadsheet

J

Jeff Besch

Below listed is some ASP code that demonstrates using Freezepanes
within OWC. It has been tested on OWC9 and OWC10. There is not a lot
of documentation *nor* examples regarding OWC Freezepanes :-(
Hopefully this code sample will save someone time.

Jeff

PS Watch out for text wrapping of the code below

---------------------------------
<HTML>
<STYLE>
<!--
BODY {font-family:TAHOMA}

..Cell{
font-size:12;
vertical-align:top;
}

-->
</STYLE>

<FONT SIZE=2>
<BR>
This example demonstrates OWC <B>FreezePanes</B>
<BR>
<BR>
<BR>

<BODY>
<OBJECT classid=clsid:0002E510-0000-0000-C000-000000000046
id=spreadsheet1 style="width=450px;height=220px">
<param name="AutoFit" value="0">
<param name="DisplayColHeaders" value="-1">
<param name="DisplayGridlines" value="-1">
<param name="DisplayHorizontalScrollBar" value="-1">
<param name="DisplayRowHeaders" value="-1">
<param name="DisplayTitleBar" value="-1">
<param name="DisplayToolbar" value="-1">
<param name="DisplayVerticalScrollBar" value="-1">
<param name="EnableAutoCalculate" value="-1">
<param name="EnableEvents" value="-1">
<param name="MoveAfterReturn" value="-1">
<param name="MoveAfterReturnDirection" value="2">
<param name="RightToLeft" value="0">
</OBJECT>
<SCRIPT Language=VBScript>

Dim c
Dim idTmr

function window_onload()
Set c = spreadsheet1.Constants

spreadsheet1.TitleBar.Caption = "FreezePanes Example"

'Populate Spreadsheet with data
with spreadsheet1
.range("A1:C1").value = array("Column1", "Column2", "Column3")
.range("A2:A13").value = array(1, 2, 3, 4, 5, 6, 7, 8, 9, 10 ,11,
12)
.range("B2:B13").value = array(133890, 135000, 135790, 137300,
138130, 139100, 139900, 141120, 141890, 143230, 144000, 145290)
.range("B2:B13").numberformat = "0"
.range("C2:C13").value = array(1, 2, 3, 4, 5, 6, 7, 8, 9, 10 ,11,
12)
end with

spreadsheet1.Rows(1).font.bold = True
spreadsheet1.Rows(1).font.color = "white"
spreadsheet1.Rows(1).interior.color = "darkblue"
spreadsheet1.Rows(1).font.size = 10
spreadsheet1.range("A1:C13").autofitcolumns

idTmr = window.setTimeOut("Freeze", 1, "vbscript")

'***Important***
'Set focus on the cell you want to start with. This is very
important as testing has indicated
'that speadsheets with a high number of columns (i.e. columns such
as CE) cause issues with
'Freezepanes when AutoFit = 0. Bottom Line: Be explicit with the
starting cell.
spreadsheet1.range("D2").Select
end function

Sub Freeze
'***Important***
'Freezing columns is not very well documented and there are all
sorts of gotchas. It appears that
'FreezePaneLeft does exactely that...Freezes ALL columns up to but
not including the Column Letter
'specified (i.e. D3 would freeze Columns A, B, and C of the OWC
spreadsheet but not Column D.
spreadsheet1.Range("D3").FreezePanes c.ssFreezeLeft
spreadsheet1.Range("A2").FreezePanes c.ssFreezeTop
End Sub

</SCRIPT>

</BODY>
</HTML>
 

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