Ciao ragazzi, aiutatemi a risolvere questo problema.
Devo creare con asp un file word e devo "riempirlo" con i campi prelevati da un DB SqlServer in modo da ottenere una lettera che abbia al suo interno:
- Settaggio margini;
- una carta intestata dinamica che, in base alla società scelta, visualizzi diverse intestazioni e piè di pagina.
- Destinatario:
- Oggetto;
- Date e numero di documento.
- Disposizione prefissata dei campi sopraindicati.
Questi campi bisogna renderli non modificabili, in quanto prelevati dal DB, mentre il corpo della lettera deve poter essere scritto liberamente (in quanto non prelevato dal DB).
Al momento ho a disposizione due pagine ASP che si avvicinano alla soluzione, ma non la risolvono.
La prima utilizza l'oggetto Scripting.FileSystemObject. E' possibile inserire l'intestazione e il piè di pagina mediante MyFile.WriteLine "{\header\ql{\pict\jpegblip...." e MyFile.WriteLine "{\footer\ql{\pict\jpegblip...."
ma non è possibile settare i margini, prende di default i classici margini di un documento DOC.
Nella seconda, valorizzando tutta una serie di parametri:
testo="MIME-Version: 1.0"& VbCrLf &_
"Content-Location: file:///C:/0C6649EF/"& nomefileS &".htm"& VbCrLf &_
"Content-Transfer-Encoding: quoted-printable"& VbCrLf &_
"Content-Type: text/html; charset=""us-ascii"""& VbCrLf & VbCrLf &_
"<html xmlns=3D""urn:schemas-microsoft-com
ffice
ffice"""& VbCrLf &_
"xmlns:w=3D""urn:schemas-microsoft-comffice:word"""& VbCrLf &_
"xmlns=3D""http://www.w3.org/TR/REC-html40"">"& VbCrLf & VbCrLf &_
"<head>"& VbCrLf &_
"<meta http-equiv=3DContent-Type content=3D""text/html; charset=3Dus-ascii"">"& VbCrLf &_
"<meta name=3DProgId content=3DWord.Document>"& VbCrLf &_
"<meta name=3DGenerator content=3D""Microsoft Word 11"">"& VbCrLf &_
"<meta name=3DOriginator content=3D""Microsoft Word 11"">"& VbCrLf &_
"<link rel=3DFile-List href=3D"""& nomefileS &"_file/filelist.xml"">"& VbCrLf &_
"<title></title>"& VbCrLf &_
"<!--[if gte mso 9]><xml>"& VbCrLf &_
" <oocumentProperties>"& VbCrLf &_
" <o:Author>"& autore &"</o:Author>"& VbCrLf &_
" <o:Template>Normal</o:Template>"& VbCrLf &_
" <o:LastAuthor>" & autore & "</o:LastAuthor>"& VbCrLf &_
" <o:Revision>1</o:Revision>"& VbCrLf &_
" <o:TotalTime>1</o:TotalTime>"& VbCrLf &_
" <o:Created>2004-01-22T14:31:00Z</o:Created>"& VbCrLf &_
" <o:LastSaved>2004-01-22T14:33:00Z</o:LastSaved>"& VbCrLf &_
" <o:Pages>1</o:Pages>"& VbCrLf &_
" <o:Words>4</o:Words>"& VbCrLf &_
" <o:Characters>24</o:Characters>"& VbCrLf &_
" <o:Company>"& azienda &"</o:Company>"& VbCrLf &_
" <o:Lines>1</o:Lines>"& VbCrLf &_
" <o:Paragraphs>1</o:Paragraphs>"& VbCrLf &_
" <o:CharactersWithSpaces>27</o:CharactersWithSpaces>"& VbCrLf &_
" <o:Version>11.5703</o:Version>"& VbCrLf &_
"</oocumentProperties>"& VbCrLf &_
"</xml><![endif]--><!--[if gte mso 9]><xml>"& VbCrLf &_
"<w:WordDocument>"& VbCrLf &_
" <w:View>Print</w:View>"& VbCrLf &_
" <w:Zoom>90</w:Zoom>"& VbCrLf &_
" <w:SpellingState>Clean</w:SpellingState>"& VbCrLf &_
" <w:GrammarState>Clean</w:GrammarState>"& VbCrLf &_
" <w:HyphenationZone>14</w:HyphenationZone>"& VbCrLf &_
" <w:ValidateAgainstSchemas/>"& VbCrLf &_
" <w:SaveIfXMLInvalid>false</w:SaveIfXMLInvalid>"& VbCrLf &_
" <w:IgnoreMixedContent>false</w:IgnoreMixedContent>"& VbCrLf &_
" <w:AlwaysShowPlaceholderText>false</w:AlwaysShowPlaceholderText>"& VbCrLf &_
" <w:Compatibility>"& VbCrLf &_
" <w:BreakWrappedTables/>"& VbCrLf &_
" <w:SnapToGridInCell/>"& VbCrLf &_
" <w:WrapTextWithPunct/>"& VbCrLf &_
" <w:UseAsianBreakRules/>"& VbCrLf &_
" <w:UseWord2002TableStyleRules/>"& VbCrLf &_
" </w:Compatibility>"& VbCrLf &_
" <w:BrowserLevel>MicrosoftInternetExplorer4</w:BrowserLevel>"& VbCrLf &_
" </w:WordDocument>"& VbCrLf &_
"</xml><![endif]--><!--[if gte mso 9]><xml>"& VbCrLf &_
"<w:LatentStyles DefLockedState=3D""false"" LatentStyleCount=3D""156"">"& VbCrLf &_
"</w:LatentStyles>"& VbCrLf &_
"</xml><![endif]-->"& VbCrLf &_
"<style>"& VbCrLf &_
"<!--"& VbCrLf &_
" /* Style Definitions */"& VbCrLf &_
" p.MsoNormal, li.MsoNormal, div.MsoNormal"& VbCrLf &_
" {mso-style-parent:"""";"& VbCrLf &_
" margin:0cm;"& VbCrLf &_
" margin-bottom:.0001pt;"& VbCrLf &_
" mso-pagination:widow-orphan;"& VbCrLf &_
" font-size:12.0pt;"& VbCrLf &_
" font-family:""Arial"";"& VbCrLf &_
" mso-fareast-font-family:""Arial"";}"& VbCrLf &_
"@page Section1"& VbCrLf &_
" {size:595.3pt 841.9pt;"& VbCrLf &_
" margin:0.85pt 0cm 0cm 0cm;"& VbCrLf &_
" mso-header-margin:10.4pt;"& VbCrLf &_
" mso-footer-margin:10.4pt;"& VbCrLf &_
" mso-paper-source:0;}"& VbCrLf &_
"div.Section1"& VbCrLf &_
" {page:Section1;}"& VbCrLf &_
"-->"& VbCrLf &_
"</style>"& VbCrLf &_
"<!--[if gte mso 10]>"& VbCrLf &_
"<style>"& VbCrLf &_
" /* Style Definitions */"& VbCrLf &_
" table.MsoNormalTable"& VbCrLf &_
" {mso-style-name:""Tabella normale"";"& VbCrLf &_
" mso-tstyle-rowband-size:0;"& VbCrLf &_
" mso-tstyle-colband-size:0;"& VbCrLf &_
" mso-style-noshow:yes;"& VbCrLf &_
" mso-style-parent:"""";"& VbCrLf &_
" mso-padding-alt:0cm 5.4pt 0cm 5.4pt;"& VbCrLf &_
" mso-para-margin:0cm;"& VbCrLf &_
" mso-para-margin-bottom:.0001pt;"& VbCrLf &_
" mso-pagination:widow-orphan;"& VbCrLf &_
" font-size:10.0pt;"& VbCrLf &_
" font-family:""Arial"";"& VbCrLf &_
" mso-ansi-language:#0400;"& VbCrLf &_
" mso-fareast-language:#0400;"& VbCrLf &_
" mso-bidi-language:#0400;}"& VbCrLf &_
"table.MsoTableGrid"& VbCrLf &_
" {mso-style-name:""Griglia tabella"";"& VbCrLf &_
" mso-tstyle-rowband-size:0;"& VbCrLf &_
" mso-tstyle-colband-size:0;"& VbCrLf &_
" border:solid windowtext 1.0pt;"& VbCrLf &_
" mso-border-alt:solid windowtext .5pt;"& VbCrLf &_
" mso-padding-alt:0cm 5.4pt 0cm 5.4pt;"& VbCrLf &_
" mso-border-insideh:.5pt solid windowtext;"& VbCrLf &_
" mso-border-insidev:.5pt solid windowtext;"& VbCrLf &_
" mso-para-margin:0cm;"& VbCrLf &_
" mso-para-margin-bottom:.0001pt;"& VbCrLf &_
" mso-pagination:widow-orphan;"& VbCrLf &_
" font-size:10.0pt;"& VbCrLf &_
" font-family:""Arial"";"& VbCrLf &_
" mso-ansi-language:#0400;"& VbCrLf &_
" mso-fareast-language:#0400;"& VbCrLf &_
" mso-bidi-language:#0400;}"& VbCrLf &_
"</style>"& VbCrLf &_
"<![endif]-->"& VbCrLf &_
"</head>"& VbCrLf & VbCrLf &_
"<body lang=3DIT style=3D'tab-interval:35.4pt'>"& VbCrLf & VbCrLf &_
"<div class=3DSection1>"& VbCrLf & VbCrLf &_
"<p class=3DMsoNormal>Pagina 1 - Testo di esempio</p>"& VbCrLf & VbCrLf &_
"</div>"& VbCrLf & VbCrLf &_
"</body>"& VbCrLf & VbCrLf &_
"</html>"
si ottiene una pagina in cui è possibile settare i margini.... ma non è più possibile inserire l'immagine per l'intestazione e il piè di pagina.
Potete darmi una mano per favore o quantomeno indicarmi un link o un tutorial dove ci sono spiegate le cose che mi servono?
In asp sarebbe preferibile, altrimenti sono disponibile ad una eventuale migrazione in .Net.
Resto in attesa,
Grazie anticipatamente.
Ale.

=3D""urn:schemas-microsoft-com
ocumentProperties>"& VbCrLf &_ 
Rispondi quotando

