1

Konu: to html

meraba arkadaşlar bir txt dosyasını veya dbf dosyasını html dosyasına cevırmek ıstıyorum vede html sayfasının yazı fontunuda ayarlayabilmeliyim cunku gorunmesı ıcın fontu küçültmem gerek .bunuda prg olarak yapmalıyım yanı ekrana bır pencere gelmeden windowsta alt tarafta çalışıp kapanacak . teşekkurler.

fox un örneklerında var ama dedgım gıbı orda bi screen uzerınde yapmışlar ben prg olarak yapmam gerekıyor

2 Son düzenleyen, ugurlu2001 (04.11.2010 10:52:45)

Re: to html

Visual Fox Pro
*Author : Cetin BASOZ

* Modified by : ?? :)
* Public code forum foxpro forums.
 
Public oForm
oForm = NewObject('HTMLViewerForm')
oForm.Show
 
Local loDocument
loDocument = oForm.htMLVIEWER.obJECT.document
Select cust_id,company,contact,country,region from customer into cursor crsCustomer
 
loTableX = _GetTable(loDocument)
loDocument.body.AppendChild(loTableX)
_cliptext = loDocument.body.outerHTML
 
Procedure _GetTable
Lparameters toDocument
Local Array aHeaders[1], aColumns[1]
 
Local oTable,oThead,oTFoot,oTBody,oCaption, jx
oTable = toDocument.createElement("TABLE")
oThead = toDocument.createElement("THEAD")
oTBody1 = toDocument.createElement("TBODY")
oTBody2 = toDocument.createElement("TBODY")
oTBody3 = toDocument.createElement("TBODY")
oTFoot = toDocument.createElement("TFOOT")
oCaption = toDocument.createElement("CAPTION")
 
* Insert the created elements into oTable.
With oTable
    .Border = 1
    .Id = 'customers'
    *.Style.borderCollapse="collapse"
    .Style.BorderColor = "#000000"
    .Style.BorderWidth = "thin"
    .Style.BorderStyle = "solid"
    .appendChild(oThead)
    .appendChild(oTBody1)
    .appendChild(oTBody2)
    .appendChild(oTBody3)
    .appendChild(oTFoot)
    .appendChild(oCaption)
    .cellSpacing = 0
    .cellPadding = 0
Endwith
oTBody1.bgColor = "#E0E0E0"
oTBody2.bgColor = "#00FFFF"
oTBody3.bgColor = "#FF00FF"
 
Select crsCustomer
* Insert a row into the header and set its background color.
oThead.bgColor = "lightskyblue"
lcHeaders = "cust_id,company,contact,country"
 
oRow = toDocument.createElement("TR")
    oCell = toDocument.createElement("TH")
    oCell.rowspan = 2
    oCell.innerText = "Customer ID"
    oRow.appendChild(oCell)
 
    oCell = toDocument.createElement("TH")
    oCell.rowspan = 2
    oCell.innerText = "Company"
    oRow.appendChild(oCell)
 
    oCell = toDocument.createElement("TH")
    oCell.colspan = 2
    oCell.innerText = "Showed Up"
    oRow.appendChild(oCell)
 
oThead.appendChild(oRow)
oRow = toDocument.createElement("TR")
    oCell = toDocument.createElement("TH")
    oCell.innerText = "Contact"
    oRow.appendChild(oCell)
    oCell = toDocument.createElement("TH")
    oCell.innerText = "Country"
    oRow.appendChild(oCell)
oThead.appendChild(oRow)
 
 
Scan
    oRow = toDocument.createElement("TR")
    If country='USA'
    oTBody2.appendChild(oRow)
    Else
    If country='Germany'
    oTBody1.appendChild(oRow)
    Else
    oTBody3.appendChild(oRow)
    endif
    endif
 
*CustID
        oCell = toDocument.createElement("TD")
        oCell.Rowspan=2
        oCell.style.fontWeight = "bold"
        oCell.innerText = Trim(cust_id)
        oRow.appendChild(oCell)
*Company
        oCell = toDocument.createElement("TD")
*       oCell.Rowspan=2
        oCell.innerText = Trim(company)
        oRow.appendChild(oCell)
*Contact
        oCell = toDocument.createElement("TD")
*       oCell.Rowspan=2
        oCell.innerText = Trim(contact)
        oRow.appendChild(oCell)
* Country and region
        oCell = toDocument.createElement("TD")
*       oCell.Rowspan=2
        oCell.innerText = Trim(country)
        oRow.appendChild(oCell)
 
    oSubRow = toDocument.createElement("TR")
    If country='USA'
    oTBody2.appendChild(oSubRow)
    Else
    If country='Germany'
    oTBody1.appendChild(oSubRow)
    Else
    oTBody3.appendChild(oSubRow)
    endif
    endif
 
* Country and region
        oCell = toDocument.createElement("TD")
        oCell.colspan=3
        oCell.style.fontStyle = "italic"
        oCell.innerText = Trim(country - (' - ' + region))
 
If region='WA'
    oCell.bgColor = "#FF2020"
endif
        oSubRow.appendChild(oCell)
 
Endscan
 
* Create and insert rows and cells into the footer row.
oRow = toDocument.createElement("TR")
oTFoot.appendChild(oRow)
oCell = toDocument.createElement("TD")
oRow.appendChild(oCell)
oCell.innerText = Textmerge("Total <<Reccount()>>")
oCell.colSpan = 4
oCell.bgColor = "lightskyblue"
 
* Set the innerText of the caption and position it at the bottom of the table.
oCaption.innerText = "Caption Here"
oCaption.Style.FontSize = "14 pt"
oCaption.Style.Color = "Blue"
oCaption.Align = "top"
Return oTable
 
Define Class HTMLViewerForm As Form
  DataSession = 2
  Top = 0
  Left = 0
  Height = 500
  Width = 800
  DoCreate = .T.
  Caption = "HTML sample"
  cHTML = ""
  cHTMFile = Forcepath(Sys(2015)+'.htm',Sys(2023))
  EmptyHTM = Forcepath('empty.htm',Sys(2023))
  DoNotErase = .F.
 
  Add Object htmlviewer As OleControl With ;
    Top = 0, Left = 0, Height = 500, Width = 800, Visible = .T., ;
    OleClass = 'Shell.Explorer'
 
  Procedure Init
  Text to m.lcBody noshow
<html>
<HEAD>
<STYLE>
.menuItem {font-family:sans-serif;font-size:10pt;width:100;padding-left:20;
   background-Color:menu;color:black}
.highlightItem {font-family:sans-serif;font-size:10pt;width:100;padding-left:20;
   background-Color:highlight;color:white}
.clickableSpan {padding:4;width:500;background-Color:blue;color:white;border:5px gray solid}
</STYLE>
 
<SCRIPT>
//<!--
 
function displayMenu() {
   whichDiv=event.srcElement;
   menu1.style.leftPos+=10;
   menu1.style.posLeft=event.clientX;
   menu1.style.posTop=event.clientY;
   menu1.style.display="";
   menu1.setCapture();
}
function switchMenu() {   
   el=event.srcElement;
   if (el.className=="menuItem") {
      el.className="highlightItem";
   } else if (el.className=="highlightItem") {
      el.className="menuItem";
   }
}
function clickMenu() {
   menu1.releaseCapture();
   menu1.style.display="none";
   el=event.srcElement;
   if (el.id=="mnuRed") {
      whichDiv.style.backgroundColor="red";
   } else if (el.id=="mnuGreen") {
      whichDiv.style.backgroundColor="green";   
   } else if (el.id=="mnuBlue") {
      whichDiv.style.backgroundColor="blue";   
   } else if (el.id=="mnuYellow") {
      whichDiv.style.backgroundColor="yellow";   
   }
}
 
//-->
</SCRIPT>
</HEAD>
 
<body oncontextmenu="if (!event.ctrlKey){displayMenu();return false;}">
<div id=menu1 onclick="clickMenu()" onmouseover="switchMenu()" onmouseout="switchMenu()" style="position:absolute;display:none;width:100;background-Color:menu; border: outset 3px gray">
<div class="menuItem" id=mnuRed>Red</div>
<div class="menuItem" id=mnuGreen>Green</div>
<div class="menuItem" id=mnuBlue>Blue</div>
<div class="menuItem" id=mnuYellow>Yellow</div>
</div><body></html>
  endtext
 
 
 
*   StrToFile('<HTML><BODY oncontextmenu="return  false"></BODY></HTML>',this.cHTMFile)
    StrToFile(m.lcBody,this.cHTMFile)
 
    This.htmlviewer.navigate2('file://'+this.cHTMFile)
*!*     This.htmlviewer.navigate2('about:blank')
*!*     With This.htmlviewer.Document
*!*       oBody = .createElement('body')
*!*       oBody.oncontextmenu = "return false"
*!*       .appendChild(oBody)
*!*     Endwith
  EndProc
   Procedure Destroy
   Erase (this.cHTMFile)
   endproc
 
  Procedure htmlviewer.Refresh
    Nodefault
  Endproc
 
  Procedure Resize
    This.htmlviewer.Height = This.Height
    This.htmlviewer.Width  = This.Width
  Endproc
Enddefine
Uğur
-------------------------------------------------------------------------------------------------------------
Hayat bir bisiklete binmek gibidir. Pedalı çevirmeye devam ettiğiniz sürece düşmezsiniz. Claude Peppeer
Kusuru söylenmeyen adam, ayıbını hüner sanır.  Türk Atasözü

3 Son düzenleyen, cetinbasoz (04.11.2010 12:15:30)

Re: to html

Kaynagini sabahlari aynada goruyorum:)

Duzeltme: Asil kaynagi goruyorum ama bu modifiye edilmis.Modifiye edeni bilmiyorum.
Duzeltme: Modifiye edeni de buldum:) Ne zaman ve neden etmisim anlamadim.

4

Re: to html

Çetin hocam Add Object htmlviewer As OleControl With    satırınca unreconized  command verb hatasi veriyor

5

Re: to html

Kodda ne degisiklik yaptin o hatayi almak icin ona bak.

6

Re: to html

çetin hocam direk copy -paste yaptım

7 Son düzenleyen, cetinbasoz (07.11.2010 02:49:59)

Re: to html

Yapamamissin demekki. Copy paste sirasinda birseyler kaybolmus olabilir kontrol et ya da yeniden yaz.

Turkcede ozel isimler buyuk harfle baslar.

8

Re: to html

Çetin abi istersen bi dene olmuyor çünki

9

Re: to html

Denedim gene calisiyor:

http://screencast.com/t/EK5wsn0ZPPQ

10

Re: to html

:)Petkom haklı Çetin,
Bende kopyaladım yapıştırdım çalışmadı .. Ama bazı tahminlerim var.

Visual Fox Pro
*Author : Cetin BASOZ

* Modified by : ?? :)
* Public code forum foxpro forums.

Bu kodları sen mi icat ettin.

Visual Fox Pro
Select cust_id,company,contact,country,region from customer into cursor crsCustomer

Birde burda hata veriyor. Galiba alan adlarını yanlış yazmışsın.  smile

11 Son düzenleyen, konuka (08.11.2010 21:23:16)

Re: to html

SELECT * FROM ("C:\Program Files\Microsoft Visual FoxPro 9\Samples\Data\customer")
veya
SET DEFA TO ("C:\Program Files\Microsoft Visual FoxPro 9\Samples\Data")

ayrıca copy/paste direk yapma, önce ALINTI YAP oradan kopyala.
2 satırı aşan komutlarda ; !!!!

VFP9 SP2

12

Re: to html

Yazılım geliştiriciler genellikle zamanı olmayan  insanlardır.  Bu yüzden nerdeyse gerekmedikçe iletişime dahi geçmezler. Herhalde bu yüzden asosyal olarak hemen damgalanırlar. Çetin 'deki  sabır düzeyine ve harcadığı zamana hayranım.

Neyse, onun yerine isyan ediyorum. Yahu 250 küsur satırlık hazır kodu almışsın harcanan emeğin ve zamanın yüzde birini harca neden hata verdiğini kendin bul. Bizde öğrenelim ki kodda hata falan da yok.

13 Son düzenleyen, cetinbasoz (09.11.2010 02:03:32)

Re: to html

Aligocmen yazdı:

:)Petkom haklı Çetin,
Bende kopyaladım yapıştırdım çalışmadı .. Ama bazı tahminlerim var.

Visual Fox Pro
*Author : Cetin BASOZ

* Modified by : ?? :)
* Public code forum foxpro forums.

Bu kodları sen mi icat ettin.

Visual Fox Pro
Select cust_id,company,contact,country,region from customer into cursor crsCustomer

Birde burda hata veriyor. Galiba alan adlarını yanlış yazmışsın.  smile

Evet kod benim:) Modifikasyonu da yapmisim hatirlamadim.

Ne hatasi veriyor? O testdata'nin Customer dosyasi ve alanlar dogru. Northwind Customers dosyasinda alan adlari farkli.

Ali'nin dedigi gibi:

Visual Fox Pro
Select cust_id,company,contact,country,region from (_samples+'data\customer') into cursor crsCustomer

usengeclik etmisim:)

Video kaydinda ses cok kotu di mi:)

14

Re: to html

hersey ıcın tsekurler arkaslar