Discussion in 'OT Technology' started by michelin man, Jul 15, 2003.
i need to rotate a spreadsheet.
how can i do it excel or access ??
write java program to do it using buffered readers ^_^
and string tokenizers
filewriters, oh my.
Could you provide an example so the best solution can be given?
I don't have an example, but Ill try to quickly explain this before my meeting.
well first export the excel sheet to a tab deliminated text file.
then in your java program using a bufferedReader and a StringTokenizer, read the data in and save it to a String (with the same dimentions as your excel file)
say your array is
String a = new String[x][y]
you'll need to create another String, but with the dimensions
String b = new String[y][x] (this should be easy enough to see because you are just going to invert the axis of the array.)
for (int j=0; j<a.length() // this will be the width of the first String; j++)
for(int i = 0; i<a.length(); /*(this will be the length of the first string).*/ i++)
b[j] = a[j];
then write out your new array using a tab delimited file writer.
then import that into excel.
sorry if this chickenscratch is hard to understand, if you don't get what I mean, ask me. I'll come back after my meeting.
the data looks like this
and i need it to look like this
You can do this without programming at all.
Select the data and edit\copy.
Then select a new area (or sheet) to paste it to and select edit\paste special.
In the dialog box that comes up,
select the check box at the bottom that says tranpose.
That should get you where you want to be.
Damn, beat me to it. Paste Special: Transpose
i just found it on another site..... thanks for the help
1. Select ALL the cells you want to copy and Copy
2. Select a new sheet and activate A1
3. Edit/Paste Special - check the Transpose Checkbox - OK
meh. I'm still going to write the program and post the source code for it when I get home.
i'm a dork
Why would you do it in Java? Excel VBA lets you do the same thing without having to export/import data.
because I like java
and because he's a dork