Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
I finally fixed all excel C0000005 errors!
Message
De
19/12/2005 16:25:45
 
 
Information générale
Forum:
Visual FoxPro
Catégorie:
COM/DCOM et OLE Automation
Versions des environnements
Visual FoxPro:
VFP 6 SP5
OS:
Windows 2000 SP4
Database:
Visual FoxPro
Divers
Thread ID:
01076566
Message ID:
01079336
Vues:
39
Escellent! And as you say without touching automation. Thank you.

Alex


>no problem,
>
>An empty excel xml file will be something like this, I'd edit this by adding styles I'd need for my report and perhaps even the header of my report and have this saved as a template text file to load in.
>
><?xml version="1.0"?>
><Workbook xmlns="urn:schemas-microsoft-com:office:spreadsheet"
> xmlns:o="urn:schemas-microsoft-com:office:office"
> xmlns:x="urn:schemas-microsoft-com:office:excel"
> xmlns:ss="urn:schemas-microsoft-com:office:spreadsheet">
> <DocumentProperties xmlns="urn:schemas-microsoft-com:office:office">
>  <Version>10.2625</Version>
> </DocumentProperties>
> <OfficeDocumentSettings xmlns="urn:schemas-microsoft-com:office:office">
> </OfficeDocumentSettings>
> <ExcelWorkbook xmlns="urn:schemas-microsoft-com:office:excel">
>  <WindowHeight>9000</WindowHeight>
>  <WindowWidth>13860</WindowWidth>
>  <WindowTopX>240</WindowTopX>
>  <WindowTopY>75</WindowTopY>
>  <ProtectStructure>False</ProtectStructure>
>  <ProtectWindows>False</ProtectWindows>
> </ExcelWorkbook>
> <Styles>
>  <Style ss:ID="Default" ss:Name="Normal">
>   <Font ss:FontName="Arial1" ss:Size="10"/>
>  </Style>
> </Styles>
>
> <Worksheet ss:Name="Sheet1">
> </Worksheet>
>
></Workbook>
>
>
>I'd then read this in line by line til I go to the start of the worksheet and add my content.
>
>
>   <Table ss:DefaultColumnWidth="50" ss:DefaultRowHeight="15.75">
>    <Column ss:Width="100"/>
>    <Column ss:Width="100"/>
>    <Row ss:Height="15.75">
>     <Cell ss:StyleID="Default"><Data ss:Type="String">This is my test sheet</Data></Cell>
>     <Cell ss:StyleID="Default"><Data ss:Type="Number">1234567890</Data></Cell>
>    </Row>
>   </Table>
>
>
>save that textfile as yournewxslfile.xsl and you should have a working excel file without touching automation.
>
>so my code in fox for adding a new row to that looks like this
>
>
>tstring1 = fgets(templatefile,1000)
>do while alltrim(tstring1) != "</Table>"		
> fputs(newxlsfile,tstring1) && Write string into file
> tstring1 = fgets(templatefile,1000)					
>enddo	
>							
>tstring =  '<Row ss:Height="15.75">'
>fputs(newxlsfile,tstring) && Write string into file	
>tstring =  '<Cell ss:StyleID="Default"><Data ss:Type="String">' + alltrim(mystring_variable) + '</Data></Cell>'
>fputs(newxlsfile,tstring) && Write string into file
>tstring =  '<Cell ss:StyleID="Default"><Data ss:Type="Number">' + alltrim(mynumber_variable) + '</Data></Cell>'
>tstring =  '</Row>'
>fputs(newxlsfile,tstring) && Write string into file
>tstring =  '</Table>'
>fputs(newxlsfile,tstring) && Write string into file
>tstring =  ' </Worksheet>'
>fputs(newxlsfile,tstring) && Write string into file
>tstring =  '</Workbook>'
>fputs(newxlsfile,tstring) && Write string into file
>
>
>pretty much everything is available right down to conditional formatting and the like.
>
>I suggest creating very simple spreadsheets in excel that contail just the style or effect you want to apply and then in excel saveas xml, open the file in a text editor and you should be able to work out quite easily how to do it.
>
>also the full helpfiles for the office xml formats are available from microsoft here
>http://www.microsoft.com/downloads/details.aspx?FamilyId=FE118952-3547-420A-A412-00A2662442D9&displaylang=en
>
>Hope that helps.
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform