Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Hidden columns in Excel
Message
 
À
17/08/2006 11:02:08
Information générale
Forum:
Visual FoxPro
Catégorie:
COM/DCOM et OLE Automation
Versions des environnements
Visual FoxPro:
VFP 9 SP1
OS:
Windows XP
Database:
Visual FoxPro
Divers
Thread ID:
01146393
Message ID:
01146437
Vues:
17
>Hi everybody,
>
>I'm converting xls into dbf. I have the following piece of code:
>
>
>for lnI = 1 to m.lnCols
>					.Cells(1,laFieldNames[m.lnI,3]).value = laFieldNames[m.lnI,1]
>					try
>						if .range(chr(64 + m.lnI) + ":" + chr(64 + m.lnI)).columns.columnwidth < 50
>							.range(chr(64 + m.lnI) + ":" + chr(64 + m.lnI)).columns.columnwidth = ;
>								.range(chr(64 + m.lnI) + ":" + chr(64 + m.lnI)).columns.columnwidth * 5 && To make sure long descriptions fit
>						endif
>					catch to loRangeProblem
>* Let's ignore this error with the range and column width
>					endtry
>				next
>
>I found that several columns were hidden. They didn't end up in the resulting dbf. What should I do to make sure all columns are in my table?
>
>I also have another question. How can I lock the row with the headers when I output dbf to Excel?
>
>Thanks in advance.

Unhide colums with:
LOCAL oExcel AS Excel.Application
oExcel = CREATEOBJECT([Excel.Application])
oExcel.Workbooks.Add()
oExcel.Columns([B:C]).Select
oExcel.Selection.EntireColumn.Hidden = .t.  && Hide columns B and C
oExcel.Visible = .t.
INKEY(0)
oExcel.Columns([A:IV]).Select
oExcel.Selection.EntireColumn.Hidden = .f.  && Unhide all hidden columns
INKEY(0)
*** Freeze first row of sheet
oExcel.Rows("2:2").Select
oExcel.ActiveWindow.FreezePanes = .t.
INKEY(0)
Against Stupidity the Gods themselves Contend in Vain - Johann Christoph Friedrich von Schiller
The only thing normal about database guys is their tables.
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform