[lnkForumImage]
TotalShareware - Download Free Software

Confronta i prezzi di migliaia di prodotti.
Asp Forum
 Home | Login | Register | Search 


 

avi

1/9/2012 10:04:00 AM

Hello,

I'm looking for some code that transposes the grid table (Row become
columns and columns become rows)

Thanks
Avi
4 Answers

Jimekus

1/9/2012 11:12:00 AM

0

On Jan 9, 11:03 pm, avi <avi...@bezeqint.net.il> wrote:
> Hello,
>
> I'm looking for some code that transposes the grid table (Row become
> columns and columns become rows)
>
> Thanks
> Avi

Presumably you are normally saving your table to a text file by rows
and columns. So, just write the table to a transposed text file by
columns and rows and then reload that text file with your normal input
routine. The following is a snippet of code minus the normal headers
and footers that normally accompany my saved tables.

NB: because I have some cells that contain carriage returns and line
feeds, these are spaced out first before printing so as to not upset
the normal delimiters you need when rereading the transposed table.

Open FullGridName For Output As #One

.... header... goes here.
For ColItem = One To LastDataCol + Three
workz6 = GridIn.Table.TextMatrix(One, ColItem)
While InStr(workz6, vbLf)
Mid$(workz6, InStr(workz6, vbLf), One) = ASpace
Wend
Print #One, workz6;
For RowItem = Two To NmC + Three
workz6 = GridIn.Table.TextMatrix(RowItem, ColItem)
While InStr(workz6, vbCr)
Mid$(workz6, InStr(workz6, vbCr), One) = ASpace
Wend
While InStr(workz6, vbLf)
Mid$(workz6, InStr(workz6, vbLf), One) = ASpace
Wend
Print #One, vbTab; workz6;
Next
Print #One,
Next
Print #One, Zero ' zero signifies that there is no footer.

Close #One

..... this is where you would reload the file using your normal load
routine.

mm

1/9/2012 12:52:00 PM

0

On 09/01/2012 07:03 a.m., avi wrote:
> Hello,
>
> I'm looking for some code that transposes the grid table (Row become
> columns and columns become rows)
>
> Thanks
> Avi

Public Sub TransposeFlex(nFlexGrid As MSFlexGrid)
Dim iColsThatWillBeRows As Long
Dim iRowsThatWillBeCols As Long
Dim iFixedColsThatWillBeFixedRows As Long
Dim iFixedRowsThatWillBeFixedCols As Long
Dim iMatrix()
Dim r As Long
Dim c As Long

iColsThatWillBeRows = nFlexGrid.Cols
iRowsThatWillBeCols = nFlexGrid.Rows
iFixedColsThatWillBeFixedRows = nFlexGrid.FixedCols
iFixedRowsThatWillBeFixedCols = nFlexGrid.FixedRows

ReDim iMatrix(nFlexGrid.Rows, nFlexGrid.Cols)
For c = 0 To nFlexGrid.Cols - 1
For r = 0 To nFlexGrid.Rows - 1
iMatrix(r, c) = nFlexGrid.TextMatrix(r, c)
Next r
Next c

nFlexGrid.Clear
nFlexGrid.Cols = iRowsThatWillBeCols
nFlexGrid.Rows = iColsThatWillBeRows
nFlexGrid.FixedCols = iFixedRowsThatWillBeFixedCols
nFlexGrid.FixedRows = iFixedColsThatWillBeFixedRows

For c = 0 To nFlexGrid.Cols - 1
For r = 0 To nFlexGrid.Rows - 1
nFlexGrid.TextMatrix(r, c) = iMatrix(c, r)
Next r
Next c
End Sub

bosodeniro

4/8/2014 6:08:00 PM

0

The victims of genocide be they Jews, Tutsis, Armenians are hated twice -- first because they expose the natural Nazis among us, and secondly thay bring the natural Nazis and hateful among us KICKING and SCREAMING into the civilized world -- and they HATE us even more for that.

Even the trolls here with their tongues in cheeks know I speak the truth about why they're really here.

bosodeniro

4/9/2014 7:00:00 PM

0

On Monday, April 7, 2014 8:36:04 PM UTC-7, The Revd wrote:
> On Mon, 7 Apr 2014 18:28:52 -0700 (PDT), bosodeniro@gmail.com wrote:
>
>
>
> >You can deny it all you want,
>
>
>
> You can market and promote it all you want. It never happened.

You're just a troll an an asshole, radavich, and btw your colostomy smells from way over here