Php export rtf包含css文件

时间:2014-03-21 03:43:19

标签: php html css rtf

我想用php导出rtf文件,但我不知道为什么涉及到css文件。

当我打开带扩展名的文件时。 Rtf与Microsoft Office 2007.

它说“在加载过程中出现以下问题:

  1. 缺少文件:C / Users / user pc / Downloads / style.css
  2. 缺少文件:C / Users / user pc / Downloads / css / templates.css
  3. 缺少文件:C / Users / user pc / Downloads / css / mainmenu-horizo​​ntal.css“
  4. 这是我的代码:

    <form name="frm" method="post">
        <input class="textbox" type="hidden" name="data[judulbeasiswa]" value="<?php echo $info['jdlbeasiswa']; ?>" />
        <table class="modform" width="100%">
             <tr class="<?php echo bg(); ?>">
                <td width="15%">Nama Lengkap</td>
                <td width="85%"><input class="textbox" type="text" name="data[nmdaftar]" value="<?php echo $data['nmdaftar']; ?>" /></td>
            </tr>
             <tr class="<?php echo bg(); ?>">
                <td>Tempat Lahir</td>
                <td><input class="textbox" type="text" name="data[tmpdaftar]" value="<?php echo $data['tmpdaftar']; ?>" /></td>
            </tr>
             <tr class="<?php echo bg(); ?>">
                <td>Tanggal Lahir</td>
                <td><input class="textbox" type="text" name="data[tgllahirdaftar]" value="<?php echo FormatDate($data['tgllahirdaftar']); ?>"/><br />
                <b>Valid date format:</b> dd-mm-YYYY</td>
            </tr>
             <tr class="<?php echo bg(); ?>">
                <td>Fakultas</td>
                <td><input class="textbox" type="text" name="data[fkdaftar]" value="<?php echo $data['fkdaftar']; ?>" /></td>
            </tr>
            <tr class="<?php echo bg(); ?>">
                <td>Jurusan/Prodi</td>
                <td><input class="textbox" type="text" name="data[jurdaftar]" value="<?php echo $data['jurdaftar']; ?>" /></td>
            </tr>
             <tr class="<?php echo bg(); ?>">
                <td>Semester</td>
                <td><input class="textbox_short" type="text" name="data[smsdaftar]" value="<?php echo $data['smsdaftar']; ?>" /></td>
            </tr>
             <tr class="<?php echo bg(); ?>">
                <td>IPK</td>
                <td><input class="textbox_short" type="text" name="data[ipkdaftar]" value="<?php echo $data['ipkdaftar']; ?>" /></td>
            </tr>
            <tr class="<?php echo bg(); ?>">
                <td>Alamat Tinggal</td>
                <td><textarea name="data[almdaftar]" class="textbox" style="height:100px;"><?php echo $data['almdaftar']; ?></textarea></td>
            </tr>
            <tr class="<?php echo bg(); ?>">
                <td>Telephone/Handphone</td>
                <td><input class="textbox" type="text" name="data[hubdaftar]" value="<?php echo $data['hubdaftar']; ?>" /><br />
                <b>example : 027412345678</td>
            </tr>
            <tr class="<?php echo bg(); ?>">
                <td>Asal SLTA</td>
                <td><input class="textbox" type="text" name="data[asaldaftar]" value="<?php echo $data['asaldaftar']; ?>" /></td>
            </tr>
            <tr class="<?php echo bg(); ?>">
                <td>Jumlah Kiriman per bulan</td>
                <td><input class="textbox" type="text" name="data[jumkirdaftar]" value="<?php echo $data['jumkirdaftar']; ?>" /></td>
            </tr>
            <tr class="readonly">
                <td colspan="2" class="modsubtitle">Penanggung Jawab Utama</td>
            </tr>
            <tr class="<?php echo bg(); ?>">
                <td>Penanggung Utama Biaya</td>
                <td>
                <input name="data[pubdaftar]" type="radio" value="Ayah" checked="checked" <?php if($data['pubdaftar']=='Ayah') echo checked ; ?>>Ayah 
                <input name="data[pubdaftar]" type="radio" value="Ibu" <?php if($data['pubdaftar']=='Ibu') echo checked ; ?>>Ibu  
                <input name="data[pubdaftar]" type="radio" value="Saudara/Famili" <?php if($data['pubdaftar']=='Saudara/Famili') echo checked ; ?> >Saudara/Famili
                </td>
            </tr>
            <tr class="<?php echo bg(); ?>">
                <td>Nama</td>
                <td><input class="textbox" type="text" name="data[nmpubdaftar]" value="<?php echo $data['nmpubdaftar']; ?>" /></td>
            </tr>
            <tr class="<?php echo bg(); ?>">
                <td>Pekerjaan</td>
                <td><input class="textbox" type="text" name="data[pkpubdaftar]" value="<?php echo $data['pkpubdaftar']; ?>" /></td>
            </tr>
            <tr class="<?php echo bg(); ?>">
                <td>Alamat</td>
                <td><textarea name="data[alpubdaftar]" class="textbox" style="height:100px;"><?php echo $data['alpubdaftar']; ?></textarea></td>
            </tr>
            <tr class="readonly">
                <td colspan="2" class="modsubtitle">Rekening Tujuan</td>
            </tr>
            <tr class="<?php echo bg(); ?>">
                <td>Nama Rekening</td>
                <td><input class="textbox" type="text" name="data[nmrekdaftar]" value="<?php echo $data['nmrekdaftar']; ?>" /></td>
            </tr>
            <tr class="<?php echo bg(); ?>">
                <td>No Rekening</td>
                <td><input class="textbox" type="text" name="data[norekdaftar]" value="<?php echo $data['norekdaftar']; ?>" /></td>
            </tr>
            <tr class="<?php echo bg(); ?>">
                <td>Nama Bank</td>
                <td><input class="textbox" type="text" name="data[nmbankdaftar]" value="<?php echo $data['nmbankdaftar']; ?>" /></td>
            </tr>
            <tr class="<?php echo bg(); ?>">
                <td>Cabang Bank</td>
                <td><input class="textbox" type="text" name="data[cbbankdaftar]" value="<?php echo $data['cbbankdaftar']; ?>" /></td>
            </tr>
        </table>
        <div class="modform">
        <?php
            echo $row['descbeasiswa'];
        ?>
        <hr />
        Bahwasannya saya menyatakan dengan form diatas adalah benar adanya, dan apabila ditemukan tindak kecurangan maka terkait akademik dan yang melekat dengan anda menjadi kewajiban perguruan tinggi
        </div>
        <div class="modtitle" align="center">
            <input class="tombol" type="submit" name="SUPDATE" value="SUBMIT"/>
            <input class="tombol" type="submit" name="EXPORT" value="CETAK"/>
        </div>
        <input type="hidden"  name="_nim" value="<?php echo $_POST['_nim']; ?>"/>
        <input type="hidden"  name="_bea" value="<?php echo $_POST['_bea']; ?>"/>
        </form>
    

    这是我调用函数_exportRTF()

    的时候
    $mydata = _ceknim();
    $data = $_POST['data'];
    if ($_POST['EXPORT']){
     _exportRTF($mydata,$data);
    }
    

    我的函数_exportRTF()

    function _exportRTF($mydata,$data){
        $document = file_get_contents("modules/mod_beasiswa/tes/pendaftaranbeasiswa.rtf");
        // replace
        $document = str_replace("%%NAMA%%", $mydata['nama'], $document);
        $document = str_replace("%%PRODI%%", $mydata['jenjang'], $document);
        $document = str_replace("%%FAKULTAS%%", $mydata['fakultas'], $document);
        $document = str_replace("%%ANGKATAN%%", $mydata['angkatan'], $document);
    
        $document = str_replace("%%BEASISWA%%", $data['judulbeasiswa'], $document);
        $document = str_replace("%%NAMALENGKAP%%", $data['nmdaftar'], $document);
        $document = str_replace("%%TEMPATLAHIR%%", $data['tmpdaftar'], $document);
        $document = str_replace("%%TANGGALLAHIR%%", $data['tgllahirdaftar'], $document);
        $document = str_replace("%%FAKULTAS2%%", $data['fkdaftar'], $document);
        $document = str_replace("%%PRODI2%%", $data['jurdaftar'], $document);
        $document = str_replace("%%SEMESTER%%", $data['smsdaftar'], $document);
        $document = str_replace("%%IPK%%", $data['ipkdaftar'], $document);
        $document = str_replace("%%ALAMAT%%", $data['almdaftar'], $document);
        $document = str_replace("%%TELEPHONE%%", $data['hubdaftar'], $document);
        $document = str_replace("%%SLTA%%", $data['asaldaftar'], $document);
        $document = str_replace("%%JUMLAHKIRIMAN%%", $data['jumkirdaftar'], $document);
    
    
        $document = str_replace("%%PENANGGUNGUTAMA%%", $data['pubdaftar'], $document);
        $document = str_replace("%%NAMAPENANGGUNG%%", $data['nmpubdaftar'], $document);
        $document = str_replace("%%PEKERJAANPENANGGUNG%%", $data['pkpubdaftar'], $document);
        $document = str_replace("%%ALAMATPENANGGUNG%%", $data['alpubdaftar'], $document);
    
    
        $document = str_replace("%%NAMAREKENING%%", $data['nmrekdaftar'], $document);
        $document = str_replace("%%NOREKENING%%", $data['norekdaftar'], $document);
        $document = str_replace("%%NAMABANK%%", $data['nmbankdaftar'], $document);
        $document = str_replace("%%CABANGBANK%%", $data['cbbankdaftar'], $document);
    
    
        // header untuk membuka file output RTF dengan MS. Word
    
        header("Content-type: application/msword");
        header("Content-disposition: inline; filename='permohonanbeasiswa.rtf'");
        header("Content-length: " . strlen($document));
        echo $document;
    }
    

0 个答案:

没有答案