2012-11-12 2 views

답변

22

이것은 약간의 예입니다. HTML로 ms 단어 .doc 파일을 생성하려고하는 다른 사람들에게 도움이되기를 바랍니다. 형상 ID = "Picture_x0020_1을":

<html xmlns:v="urn:schemas-microsoft-com:vml" 
xmlns:o="urn:schemas-microsoft-com:office:office" 
xmlns:w="urn:schemas-microsoft-com:office:word" 
xmlns:m="http://schemas.microsoft.com/office/2004/12/omml" 
xmlns="http://www.w3.org/TR/REC-html40"> 
<head><meta http-equiv=Content-Type content="text/html; charset=utf-8"><title></title> 
<style> 
v\:* {behavior:url(#default#VML);} 
o\:* {behavior:url(#default#VML);} 
w\:* {behavior:url(#default#VML);} 
.shape {behavior:url(#default#VML);} 
</style> 
<style> 
@page 
{ 
    mso-page-orientation: landscape; 
    size:29.7cm 21cm; margin:1cm 1cm 1cm 1cm; 
} 
@page Section1 { 
    mso-header-margin:.5in; 
    mso-footer-margin:.5in; 
    mso-header: h1; 
    mso-footer: f1; 
    } 
div.Section1 { page:Section1; } 
table#hrdftrtbl 
{ 
    margin:0in 0in 0in 900in; 
    width:1px; 
    height:1px; 
    overflow:hidden; 
} 
p.MsoFooter, li.MsoFooter, div.MsoFooter 
{ 
    margin:0in; 
    margin-bottom:.0001pt; 
    mso-pagination:widow-orphan; 
    tab-stops:center 3.0in right 6.0in; 
    font-size:12.0pt; 
} 
</style> 
<xml> 
<w:WordDocument> 
<w:View>Print</w:View> 
<w:Zoom>100</w:Zoom> 
<w:DoNotOptimizeForBrowser/> 
</w:WordDocument> 
</xml> 
</head> 

<body> 
<div class="Section1"> 

    <p>&nbsp;</p> 
<br/> 
    <table id='hrdftrtbl' border='0' cellspacing='0' cellpadding='0'> 
    <tr><td>  <div style='mso-element:header' id=h1 > 
     <!-- HEADER-tags --> 
      <p class=MsoHeader >HEADER</p> 
     <!-- end HEADER-tags --> 
     </div> 
    </td> 
    <td> 
    <div style='mso-element:footer' id=f1><span style='position:relative;z-index:-1'> 
     <!-- FOOTER-tags --> 
     FOOTER 

     <span style='mso-no-proof:yes'><!--[if gte vml 1]><v:shapetype 
     id="_x0000_t75" coordsize="21600,21600" o:spt="75" o:preferrelative="t" 
     path="[email protected]@[email protected]@[email protected]@[email protected]@5xe" filled="f" stroked="f"> 
     <v:formulas> 
      <v:f eqn="if lineDrawn pixelLineWidth 0"/> 
      <v:f eqn="sum @0 1 0"/> 
      <v:f eqn="sum 0 0 @1"/> 
      <v:f eqn="prod @2 1 2"/> 
      <v:f eqn="prod @3 21600 pixelWidth"/> 
      <v:f eqn="prod @3 21600 pixelHeight"/> 
      <v:f eqn="sum @0 0 1"/> 
      <v:f eqn="prod @6 1 2"/> 
      <v:f eqn="prod @7 21600 pixelWidth"/> 
      <v:f eqn="sum @8 21600 0"/> 
      <v:f eqn="prod @7 21600 pixelHeight"/> 
      <v:f eqn="sum @10 21600 0"/> 
     </v:formulas> 
     <v:path o:extrusionok="f" gradientshapeok="t" o:connecttype="rect"/> 
     <o:lock v:ext="edit" aspectratio="t"/> 
     </v:shapetype><v:shape id="Picture_x0020_1" o:spid="_x0000_s3073" type="#_x0000_t75" 
     alt="VHB" style='position:absolute; 
     margin-right:0pt;margin-top:-400pt; 
     z-index:-1; 
     visibility:visible;mso-wrap-style:square;mso-wrap-distance-left:9pt; 
     mso-wrap-distance-top:0;mso-wrap-distance-right:9pt; 
     mso-wrap-distance-bottom:0;mso-position-horizontal:absolute; 
     mso-position-horizontal-relative:text;mso-position-vertical:absolute; 
     mso-position-vertical-relative:text'> 
     <v:imagedata src="https://www.google.bg/logos/2012/Rodin-2012-homepage.png"/> 
     </v:shape><![endif]--></span> 
      <p class=MsoFooter> 
      <span style=mso-tab-count:2'></span> 
      Page <span style='mso-field-code: PAGE '><span style='mso-no-proof:yes'></span> from <span style='mso-field-code: NUMPAGES '></span> 

     <!-- end FOOTER-tags --> 
    </span> 


     </p> 
    </div> 



    <div style='mso-element:header' id=fh1> 
     <p class=MsoHeader><span lang=EN-US style='mso-ansi-language:EN-US'>&nbsp;<o:p></o:p></span></p> 
     </div> 
     <div style='mso-element:footer' id=ff1> 
     <p class=MsoFooter><span lang=EN-US style='mso-ansi-language:EN-US'>&nbsp;<o:p></o:p></span></p> 
    </div> 

    </td></tr> 
    </table> 
</div> 

</body></html> 

당신은 요소 V에 너비, 높이, 여백 - 상단 여백 오른쪽을 설정하여 워터 마크 그림을 조정할 수 있습니다 인라인 스타일을.

+0

안녕하세요 Vencedor, 위의 코드 대신 이미지 대신 html 텍스트를 삽입 할 수 있습니까? –

3

보십시오 : 전체 예를 들어

<img src="http://www.website.com/path/to/image.jpg" width="width_in_points" height="height_in_points" style="width:width_in_poits;height:height_in_points;" /> 

:

<img src="http://www.website.com/path/to/image.jpg" width="233" height="54" style="width:233pt;height:54pt;" /> 

내가 VML 및 Word에 삽입 이미지 몹시 익숙하지 해요,하지만 지금까지 상황이가는대로 맞는 내 목적과 Word 문서에 삽입 할 수 있습니다. Word는 첫 번째로드에서 자동으로 포함을 처리합니다.

Word의 기본 측정 값은 센티미터와 점으로 모두 점으로 처리해야한다는 점에 유의하십시오. 아마도 좋은 방법은 이미지를 먼저 포함시키고, Word에서 열고, 크기를 조정해야하고 단어를 통해 이미지 측정을 얻는 것입니다. 그런 다음 응용 프로그램으로 돌아가 너비를 & 높이로 설정하십시오. Word에서 설정 한 것과 같은 비율을 유지하려고하면 이미지의 크기가 조정됩니다. 적어도 그것은 Word가 나에게 해왔 던 것입니다.

는 편집 :

나는 위의 이미지 예를 개정 -이 단어의 일부 버전에서 작동하지만, 이미지를 포함하지 않습니다. 외부 파일을 다운로드 할 것인지 묻는 파일을 열 때마다 경고 메시지가 나타납니다. 섹션에서이

 <div style='mso-element:header' id=h1 > 
      <span style='mso-no-proof:yes'> 
       <!--[if gte vml 1]> 
       <v:shapetype id="_x0000_t75" 
        coordsize="21600,21600" o:spt="75" o:preferrelative="t" path="[email protected]@[email protected]@[email protected]@[email protected]@5xe" 
        filled="f" stroked="f"> 
        <v:stroke joinstyle="miter"/> 
        <v:formulas> 
         <v:f eqn="if lineDrawn pixelLineWidth 0"/> 
         <v:f eqn="sum @0 1 0"/> 
         <v:f eqn="sum 0 0 @1"/> 
         <v:f eqn="prod @2 1 2"/> 
         <v:f eqn="prod @3 21600 pixelWidth"/> 
         <v:f eqn="prod @3 21600 pixelHeight"/> 
         <v:f eqn="sum @0 0 1"/> 
         <v:f eqn="prod @6 1 2"/> 
         <v:f eqn="prod @7 21600 pixelWidth"/> 
         <v:f eqn="sum @8 21600 0"/> 
         <v:f eqn="prod @7 21600 pixelHeight"/> 
         <v:f eqn="sum @10 21600 0"/> 
        </v:formulas> 
        <v:path o:extrusionok="f" gradientshapeok="t" o:connecttype="rect"/> 
        <o:lock v:ext="edit" aspectratio="t"/> 
       </v:shapetype> 
       <v:shape id="_x0000_s1025" type="#_x0000_t75" alt="" style='position:absolute; 
        margin-left:0;margin-top:2pt;width:537pt;height:57pt;z-index:251659264'> 
        <v:imagedata src="http://www.website.com.au/path/to/image.jpg"/> 
        <w:wrap type="square"/> 
       </v:shape> 
       <![endif]--> 
      </span> 
     </div> 

장소 : 사무실 보안 설정이 그 일을하지 못할 경우, 당신은 내가 2007 이상 사무실 일을 확인 한 첫 번째 대답을 사용하여 파일을 포함해야합니다

<style> 
v\:* {behavior:url(#default#VML);} 
o\:* {behavior:url(#default#VML);} 
w\:* {behavior:url(#default#VML);} 
.shape {behavior:url(#default#VML);} 

그냥 측정의 모든 지점에 있는지 확인하십시오.

+0

안녕하세요, 예제를 사용하면 ... 훌륭합니다! 그러나 바닥 글에 이미지를 추가해야합니다. 그것을하는 방법을 알아낼 수 없습니다. 어떤 아이디어 있니? –