Read/write xls(x)?
Posted: Fri Aug 02, 2019 12:30 pm
Is there a way to read and write Excel files, .xls and/or .xlsx? I have found some older posts but nothing is working. I found reference to PureXls but all links are dead.
http://www.purebasic.com
https://www.purebasic.fr/english/
Code: Select all
;
; File: PureXLS.pbi
; Version: 0.1 - October 2006
;
; Author: flype
; Contact: mailto:flype44@gmail.com
;
; Compiler: PureBasic 4.0
; HomePage: http://www.purebasic.com
;
; Description: API for writing - not reading - Microsoft Office Excel documents
; The file format is in XML and only support Microsoft Office XP, 2002, 2003, or better.
;
; XML in Excel and the Spreadsheet Component
; MSDN: http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dnexcl2k2/html/odc_xlsmlinss.asp
;
;{ Hierarchy of XLS/XML tags
;<?xml version="1.0" encoding="UTF-8"?>
;<Workbook>
; <Styles>
; <Style>
; <Alignment/>
; <Borders>
; <Border/>
; </Borders>
; <Font/>
; <Interior/>
; <NumberFormat/>
; <Protection/>
; </Style>
; </Styles>
; <Worksheet>
; <Table>
; <Column/>
; <Row>
; <Cell>
; <Data/>
; </Cell>
; </Row>
; </Table>
; </Worksheet>
;</Workbook>
;}
EnableExplicit
;
;- CONSTANTS - PUBLIC
;
;{ #XLS_Horizontal
#XLS_Horizontal_Automatic = "Automatic"
#XLS_Horizontal_Left = "Left"
#XLS_Horizontal_Center = "Center"
#XLS_Horizontal_Right = "Right"
#XLS_Horizontal_Fill = "Fill"
#XLS_Horizontal_Justify = "Justify"
#XLS_Horizontal_CenterAcrossSelection = "CenterAcrossSelection"
#XLS_Horizontal_Distributed = "Distributed"
#XLS_Horizontal_JustifyDistributed = "JustifyDistributed"
;}
;{ #XLS_Vertical
#XLS_Vertical_Automatic = "Automatic"
#XLS_Vertical_Top = "Top"
#XLS_Vertical_Bottom = "Bottom"
#XLS_Vertical_Center = "Center"
#XLS_Vertical_Justify = "Justify"
#XLS_Vertical_JustifyDistributed = "JustifyDistributed"
;}
;{ #XLS_ReadingOrder
#XLS_ReadingOrder_RightToLeft = "RightToLeft"
#XLS_ReadingOrder_LeftToRight = "LeftToRight"
#XLS_ReadingOrder_Context = "Context"
;}
;{ #XLS_Position
#XLS_Position_Left = "Left"
#XLS_Position_Top = "Top"
#XLS_Position_Right = "Right"
#XLS_Position_Bottom = "Bottom"
#XLS_Position_DiagonalLeft = "DiagonalLeft"
#XLS_Position_DiagonalRight = "DiagonalRight"
;}
;{ #XLS_LineStyle
#XLS_LineStyle_None = "None"
#XLS_LineStyle_Continuous = "Continuous"
#XLS_LineStyle_Dash = "Dash"
#XLS_LineStyle_Dot = "Dot"
#XLS_LineStyle_DashDot = "DashDot"
#XLS_LineStyle_DashDotDot = "DashDotDot"
#XLS_LineStyle_SlantDashDot = "SlantDashDot"
#XLS_LineStyle_Double = "Double"
;}
;{ #XLS_Color
#XLS_Color_Automatic = "Automatic"
;}
;{ #XLS_Type
#XLS_Type_Number = "Number"
#XLS_Type_DateTime = "DateTime"
#XLS_Type_Boolean = "Boolean"
#XLS_Type_String = "String"
#XLS_Type_Error = "Error"
;}
;{ #XLS_Underline
#XLS_Underline_None = "None"
#XLS_Underline_Single = "Single"
#XLS_Underline_Double = "Double"
#XLS_Underline_SingleAccounting = "SingleAccounting"
#XLS_Underline_DoubleAccounting = "DoubleAccounting"
;}
;{ #XLS_VerticalAlign
#XLS_VerticalAlign_None = "None"
#XLS_VerticalAlign_Subscript = "Subscript"
#XLS_VerticalAlign_Superscript = "Superscript"
;}
;{ #XLS_Family
#XLS_Family_Automatic = "Automatic"
#XLS_Family_Decorative = "Decorative"
#XLS_Family_Modern = "Modern"
#XLS_Family_Roman = "Roman"
#XLS_Family_Script = "Script"
#XLS_Family_Swiss = "Swiss"
;}
;{ #XLS_Pattern
#XLS_Pattern_None = "None"
#XLS_Pattern_Solid = "Solid"
#XLS_Pattern_Gray75 = "Gray75"
#XLS_Pattern_Gray50 = "Gray50"
#XLS_Pattern_Gray25 = "Gray25"
#XLS_Pattern_Gray125 = "Gray125"
#XLS_Pattern_Gray0625 = "Gray0625"
#XLS_Pattern_HorzStripe = "HorzStripe"
#XLS_Pattern_VertStripe = "VertStripe"
#XLS_Pattern_ReverseDiagStripe = "ReverseDiagStripe"
#XLS_Pattern_DiagStripe = "DiagStripe"
#XLS_Pattern_DiagCross = "DiagCross"
#XLS_Pattern_ThickDiagCross = "ThickDiagCross"
#XLS_Pattern_ThinHorzStripe = "ThinHorzStripe"
#XLS_Pattern_ThinVertStripe = "ThinVertStripe"
#XLS_Pattern_ThinReverseDiagStripe = "ThinReverseDiagStripe"
#XLS_Pattern_ThinDiagStripe = "ThinDiagStripe"
#XLS_Pattern_ThinHorzCross = "ThinHorzCross"
#XLS_Pattern_ThinDiagCross = "ThinDiagCross"
;}
;{ #XLS_Format
#XLS_Format_General = "General"
#XLS_Format_GeneralNumber = "General Number"
#XLS_Format_GeneralDate = "General Date"
#XLS_Format_LongDate = "Long Date"
#XLS_Format_MediumDate = "Medium Date"
#XLS_Format_ShortDate = "Short date"
#XLS_Format_LongTime = "Long time"
#XLS_Format_MediumTime = "Medium time"
#XLS_Format_ShortTime = "Short time"
#XLS_Format_Currency = "Currency"
#XLS_Format_EuroCurrency = "Euro Currency"
#XLS_Format_Fixed = "Fixed"
#XLS_Format_Standard = "Standard"
#XLS_Format_Percent = "Percent"
#XLS_Format_Scientific = "Scientific"
#XLS_Format_YesNo = "Yes/No"
#XLS_Format_TrueFalse = "True/False"
#XLS_Format_OnOff = "On/Off"
;}
;
;- STRUCTURES - PUBLIC
;
Structure PureXLS_Alignment
Horizontal.s ; Automatic, Left, Center, Right, Fill, Justify, CenterAcrossSelection, Distributed, JustifyDistributed
Indent.s ; Unsigned Long
ReadingOrder.s ; RightToLeft, LeftToRight, Context
Rotate.s ; Double (in degrees)
ShrinkToFit.s ; Boolean
Vertical.s ; Automatic, Top, Bottom, Center, Justify, Distributed, JustifyDistributed
VerticalText.s ; Boolean
WrapText.s ; Boolean
EndStructure
Structure PureXLS_Border
Position.s ; Left, Top, Right, Bottom, DiagonalLeft, DiagonalRight
Color.s ; #RRGGBB or Automatic
LineStyle.s ; None, Continuous, Dash, Dot, DashDot, DashDotDot, SlantDashDot, Double
Weight.s ; Double (in points)
EndStructure
Structure PureXLS_Cell
PasteFormula.s ; String
ArrayRange.s ; String
Formula.s ; String
HRef.s ; String
Index.s ; Unsigned Long
MergeAcross.s ; Unsigned Long
MergeDown.s ; Unsigned Long
StyleID.s ; ID Reference
HRefScreenTip.s ; String
EndStructure
Structure PureXLS_Column
Caption.s ; String
AutoFitWidth.s ; Boolean
Hidden.s ; Boolean
Index.s ; Unsigned Long
Span.s ; Unsigned Long
StyleID.s ; ID Reference
Width.s ; Double (in points)
EndStructure
Structure PureXLS_Data
Type.s ; Number, DateTime, Boolean, String, and Error
Ticked.s ; Boolean
EndStructure
Structure PureXLS_Font
Bold.s ; Boolean
Color.s ; #RRGGBB or Automatic
FontName.s ; String
Italic.s ; Boolean
Outline.s ; Boolean
Shadow.s ; Boolean
Size.s ; Double (in points)
StrikeThrough.s ; Boolean
Underline.s ; None, Single, Double, SingleAccounting, DoubleAccounting
VerticalAlign.s ; None, Subscript, Superscript
CharSet.s ; Unsigned Long
Family.s ; Automatic, Decorative, Modern, Roman, Script, Swiss
EndStructure
Structure PureXLS_Interior
Color.s ; #RRGGBB or Automatic
Pattern.s ; None, Solid, Gray75, Gray50, Gray25, Gray125, Gray0625, HorzStripe, VertStripe, ReverseDiagStripe, DiagStripe, DiagCross, ThickDiagCross, ThinHorzStripe, ThinVertStripe, ThinReverseDiagStripe, ThinDiagStripe, ThinHorzCross, ThinDiagCross
PatternColor.s ; #RRGGBB or Automatic
EndStructure
Structure PureXLS_NumberFormat
Format.s ; General, General Number, General Date, Long Date, Medium Date, Short Date, Long Time, Medium Time, Short Time, Currency, Euro Currency, Fixed, Standard, Percent, Scientific, Yes/No, True/False, On/Off
EndStructure
Structure PureXLS_Protection
Protect.s ; Boolean
HideFormula.s ; Boolean
EndStructure
Structure PureXLS_Row
Caption.s ; String
AutoFitHeight.s ; Boolean
Height.s ; Double (in points)
Hidden.s ; Boolean
Index.s ; Unsigned Long
Span.s ; Unsigned Long
StyleID.s ; ID Reference
EndStructure
Structure PureXLS_Style
id.s ; Unique String ID
name.s ; String
Parent.s ; ID Reference
EndStructure
Structure PureXLS_Table
DefaultColumnWidth.s ; Double (in points)
DefaultRowHeight.s ; Double (in points)
ExpandedColumnCount.s ; Unsigned Long
ExpandedRowCount.s ; Unsigned Long
LeftCell.s ; Unsigned Long
StyleID.s ; ID Reference
TopCell.s ; Unsigned Long
FullColumns.s ; Boolean
FullRows.s ; Boolean
EndStructure
Structure PureXLS_Worksheet
name.s ; String - Cannot contain /, \, ?, *, [, ].
Protect.s ; Boolean
RightToLeft.s ; Boolean
EndStructure
;
;- MACROS - PRIVATE
;
Macro PureXLS_WriteString(id, string)
WriteString(id, string, #PB_UTF8)
EndMacro
Macro PureXLS_WriteStringN(id, string)
WriteStringN(id, string, #PB_UTF8)
EndMacro
;
;- PROCEDURES - PRIVATE
;
Procedure.s PureXLS_Attribute(AttrName.s, AttrValue.s)
If AttrValue
ProcedureReturn (" " + AttrName + "=" + #DQUOTE$ + AttrValue + #DQUOTE$)
EndIf
EndProcedure
;
;- PROCEDURES - PUBLIC
;
ProcedureDLL.l PureXLS_Workbook(FileName.s)
Protected id.l = CreateFile(#PB_Any, FileName)
If IsFile(id)
PureXLS_WriteString(id, "<?xml")
PureXLS_WriteString(id, PureXLS_Attribute("version", "1.0"))
PureXLS_WriteString(id, PureXLS_Attribute("encoding", "UTF-8"))
PureXLS_WriteStringN(id, " ?>")
PureXLS_WriteString(id, "<Workbook")
PureXLS_WriteString(id, PureXLS_Attribute("xmlns", "urn:schemas-microsoft-com:office:spreadsheet"))
PureXLS_WriteString(id, PureXLS_Attribute("xmlns:x", "urn:schemas-microsoft-com:office:excel"))
PureXLS_WriteString(id, PureXLS_Attribute("xmlns:ss", "urn:schemas-microsoft-com:office:spreadsheet"))
PureXLS_WriteString(id, PureXLS_Attribute("xmlns:html", "http://www.w3.org/TR/REC-html40"))
PureXLS_WriteStringN(id, ">")
EndIf
ProcedureReturn id
EndProcedure
ProcedureDLL.l PureXLS_EndWorkbook(id.l)
If IsFile(id)
PureXLS_WriteStringN(id, "</Workbook>")
CloseFile(id)
EndIf
EndProcedure
ProcedureDLL.l PureXLS_Worksheet(id.l, name.s, Protect.s = "0", RightToLeft.s = "0")
If IsFile(id)
PureXLS_WriteString(id, "<Worksheet")
PureXLS_WriteString(id, PureXLS_Attribute("ss:Name", name))
PureXLS_WriteString(id, PureXLS_Attribute("ss:Protected", Protect))
PureXLS_WriteString(id, PureXLS_Attribute("ss:RightToLeft", RightToLeft))
PureXLS_WriteStringN(id, ">")
ProcedureReturn #True
EndIf
EndProcedure
ProcedureDLL.l PureXLS_WorksheetI(id.l, *x.PureXLS_Worksheet = #Null)
If IsFile(id)
PureXLS_WriteString(id, "<Worksheet")
If *x
PureXLS_WriteString(id, PureXLS_Attribute("ss:Name", *x\name))
PureXLS_WriteString(id, PureXLS_Attribute("ss:Protected", *x\Protect))
PureXLS_WriteString(id, PureXLS_Attribute("ss:RightToLeft", *x\RightToLeft))
EndIf
PureXLS_WriteStringN(id, ">")
ProcedureReturn #True
EndIf
EndProcedure
ProcedureDLL.l PureXLS_EndWorksheet(id.l)
If IsFile(id)
PureXLS_WriteStringN(id, "</Worksheet>")
EndIf
EndProcedure
ProcedureDLL.l PureXLS_Styles(id.l)
If IsFile(id)
PureXLS_WriteStringN(id, "<Styles>")
ProcedureReturn #True
EndIf
EndProcedure
ProcedureDLL.l PureXLS_EndStyles(id.l)
If IsFile(id)
PureXLS_WriteStringN(id, "</Styles>")
EndIf
EndProcedure
ProcedureDLL.l PureXLS_Style(doc.l, id.s, name.s = "", Parent.s = "")
If IsFile(doc)
PureXLS_WriteString(doc, "<Style")
PureXLS_WriteString(doc, PureXLS_Attribute("ss:ID", id))
PureXLS_WriteString(doc, PureXLS_Attribute("ss:Name", name))
PureXLS_WriteString(doc, PureXLS_Attribute("ss:Parent", Parent))
PureXLS_WriteStringN(doc, ">")
ProcedureReturn #True
EndIf
EndProcedure
ProcedureDLL.l PureXLS_StyleI(id.l, *x.PureXLS_Style = #Null)
If IsFile(id)
PureXLS_WriteString(id, "<Style")
If *x
PureXLS_WriteString(id, PureXLS_Attribute("ss:ID", *x\id))
PureXLS_WriteString(id, PureXLS_Attribute("ss:Name", *x\name))
PureXLS_WriteString(id, PureXLS_Attribute("ss:Parent", *x\Parent))
EndIf
PureXLS_WriteStringN(id, ">")
ProcedureReturn #True
EndIf
EndProcedure
ProcedureDLL.l PureXLS_EndStyle(id.l)
If IsFile(id)
PureXLS_WriteStringN(id, "</Style>")
EndIf
EndProcedure
ProcedureDLL.l PureXLS_Font(id.l, FontName.s = "Arial", Size.s = "12", Color.s = "#000000", Bold.s = "0")
If IsFile(id)
PureXLS_WriteString(id, "<Font")
PureXLS_WriteString(id, PureXLS_Attribute("ss:Bold", Bold))
PureXLS_WriteString(id, PureXLS_Attribute("ss:Color", Color))
PureXLS_WriteString(id, PureXLS_Attribute("ss:FontName", FontName))
PureXLS_WriteString(id, PureXLS_Attribute("ss:Size", Size))
PureXLS_WriteStringN(id, "/>")
EndIf
EndProcedure
ProcedureDLL.l PureXLS_FontI(id.l, *x.PureXLS_Font = #Null)
If IsFile(id)
PureXLS_WriteString(id, "<Font")
If *x
PureXLS_WriteString(id, PureXLS_Attribute("ss:Bold", *x\Bold))
PureXLS_WriteString(id, PureXLS_Attribute("ss:Color", *x\Color))
PureXLS_WriteString(id, PureXLS_Attribute("ss:FontName", *x\FontName))
PureXLS_WriteString(id, PureXLS_Attribute("ss:Italic", *x\Italic))
PureXLS_WriteString(id, PureXLS_Attribute("ss:Outline", *x\Outline))
PureXLS_WriteString(id, PureXLS_Attribute("ss:Shadow", *x\Shadow))
PureXLS_WriteString(id, PureXLS_Attribute("ss:Size", *x\Size))
PureXLS_WriteString(id, PureXLS_Attribute("ss:StrikeThrough", *x\StrikeThrough))
PureXLS_WriteString(id, PureXLS_Attribute("ss:Underline", *x\Underline))
PureXLS_WriteString(id, PureXLS_Attribute("ss:VerticalAlign", *x\VerticalAlign))
PureXLS_WriteString(id, PureXLS_Attribute("x:CharSet", *x\CharSet))
PureXLS_WriteString(id, PureXLS_Attribute("x:Family", *x\Family))
EndIf
PureXLS_WriteStringN(id, "/>")
EndIf
EndProcedure
ProcedureDLL.l PureXLS_Borders(id.l)
If IsFile(id)
PureXLS_WriteStringN(id, "<Borders>")
ProcedureReturn #True
EndIf
EndProcedure
ProcedureDLL.l PureXLS_EndBorders(id.l)
If IsFile(id)
PureXLS_WriteStringN(id, "</Borders>")
EndIf
EndProcedure
ProcedureDLL.l PureXLS_Border(id.l, Position.s, LineStyle.s = "Continuous", Weight.s = "1", Color.s = "Automatic")
If IsFile(id)
PureXLS_WriteString(id, "<Border")
PureXLS_WriteString(id, PureXLS_Attribute("ss:Position", Position))
PureXLS_WriteString(id, PureXLS_Attribute("ss:LineStyle", LineStyle))
PureXLS_WriteString(id, PureXLS_Attribute("ss:Weight", Weight))
PureXLS_WriteString(id, PureXLS_Attribute("ss:Color", Color))
PureXLS_WriteStringN(id, "/>")
EndIf
EndProcedure
ProcedureDLL.l PureXLS_Interior(id.l, Color.s = "#FFFFFF", Pattern.s = "Solid", PatternColor.s = "")
If IsFile(id)
PureXLS_WriteString(id, "<Interior")
PureXLS_WriteString(id, PureXLS_Attribute("ss:Color", Color))
PureXLS_WriteString(id, PureXLS_Attribute("ss:Pattern", Pattern))
PureXLS_WriteString(id, PureXLS_Attribute("ss:PatternColor", PatternColor))
PureXLS_WriteStringN(id, "/>")
EndIf
EndProcedure
ProcedureDLL.l PureXLS_InteriorI(id.l, *x.PureXLS_Interior = #Null)
If IsFile(id)
PureXLS_WriteString(id, "<Interior")
If *x
PureXLS_WriteString(id, PureXLS_Attribute("ss:Color", *x\Color))
PureXLS_WriteString(id, PureXLS_Attribute("ss:Pattern", *x\Pattern))
PureXLS_WriteString(id, PureXLS_Attribute("ss:PatternColor", *x\PatternColor))
EndIf
PureXLS_WriteStringN(id, "/>")
EndIf
EndProcedure
ProcedureDLL.l PureXLS_Alignment(id.l, Horizontal.s = "Left", Vertical.s = "Bottom")
If IsFile(id)
PureXLS_WriteString(id, "<Alignment")
PureXLS_WriteString(id, PureXLS_Attribute("ss:Horizontal", Horizontal))
PureXLS_WriteString(id, PureXLS_Attribute("ss:Vertical", Vertical))
PureXLS_WriteStringN(id, "/>")
EndIf
EndProcedure
ProcedureDLL.l PureXLS_AlignmentI(id.l, *x.PureXLS_Alignment = #Null)
If IsFile(id)
PureXLS_WriteString(id, "<Alignment")
If *x
PureXLS_WriteString(id, PureXLS_Attribute("ss:Horizontal", *x\Horizontal))
PureXLS_WriteString(id, PureXLS_Attribute("ss:Indent", *x\Indent))
PureXLS_WriteString(id, PureXLS_Attribute("ss:ReadingOrder", *x\ReadingOrder))
PureXLS_WriteString(id, PureXLS_Attribute("ss:Rotate", *x\Rotate))
PureXLS_WriteString(id, PureXLS_Attribute("ss:ShrinkToFit", *x\ShrinkToFit))
PureXLS_WriteString(id, PureXLS_Attribute("ss:Vertical", *x\Vertical))
PureXLS_WriteString(id, PureXLS_Attribute("ss:VerticalText", *x\VerticalText))
PureXLS_WriteString(id, PureXLS_Attribute("ss:WrapText", *x\WrapText))
EndIf
PureXLS_WriteStringN(id, "/>")
EndIf
EndProcedure
ProcedureDLL.l PureXLS_Table(id.l, DefaultColumnWidth.s = "", DefaultRowHeight.s = "", StyleID.s = "")
If IsFile(id)
PureXLS_WriteString(id, "<Table")
PureXLS_WriteString(id, PureXLS_Attribute("ss:DefaultColumnWidth", DefaultColumnWidth))
PureXLS_WriteString(id, PureXLS_Attribute("ss:DefaultRowHeight", DefaultRowHeight))
PureXLS_WriteString(id, PureXLS_Attribute("ss:StyleID", StyleID))
PureXLS_WriteStringN(id, ">")
ProcedureReturn #True
EndIf
EndProcedure
ProcedureDLL.l PureXLS_TableI(id.l, *x.PureXLS_Table = #Null)
If IsFile(id)
PureXLS_WriteString(id, "<Table")
If *x
PureXLS_WriteString(id, PureXLS_Attribute("ss:DefaultColumnWidth", *x\DefaultColumnWidth))
PureXLS_WriteString(id, PureXLS_Attribute("ss:DefaultRowHeight", *x\DefaultRowHeight))
PureXLS_WriteString(id, PureXLS_Attribute("ss:ExpandedColumnCount", *x\ExpandedColumnCount))
PureXLS_WriteString(id, PureXLS_Attribute("ss:ExpandedRowCount", *x\ExpandedRowCount))
PureXLS_WriteString(id, PureXLS_Attribute("ss:LeftCell", *x\LeftCell))
PureXLS_WriteString(id, PureXLS_Attribute("ss:StyleID", *x\StyleID))
PureXLS_WriteString(id, PureXLS_Attribute("ss:TopCell", *x\TopCell))
PureXLS_WriteString(id, PureXLS_Attribute("x:FullColumns", *x\FullColumns))
PureXLS_WriteString(id, PureXLS_Attribute("x:FullRows", *x\FullRows))
EndIf
PureXLS_WriteStringN(id, ">")
ProcedureReturn #True
EndIf
EndProcedure
ProcedureDLL.l PureXLS_EndTable(id.l)
If IsFile(id)
PureXLS_WriteStringN(id, "</Table>")
EndIf
EndProcedure
ProcedureDLL.l PureXLS_Column(id.l, Width.s = "", StyleID.s = "")
If IsFile(id)
PureXLS_WriteString(id, "<Column")
PureXLS_WriteString(id, PureXLS_Attribute("ss:StyleID", StyleID))
PureXLS_WriteString(id, PureXLS_Attribute("ss:Width", Width))
PureXLS_WriteStringN(id, "/>")
EndIf
EndProcedure
ProcedureDLL.l PureXLS_ColumnI(id.l, *x.PureXLS_Column = #Null)
If IsFile(id)
PureXLS_WriteString(id, "<Column")
If *x
PureXLS_WriteString(id, PureXLS_Attribute("c:Caption", *x\Caption))
PureXLS_WriteString(id, PureXLS_Attribute("ss:AutoFitWidth", *x\AutoFitWidth))
PureXLS_WriteString(id, PureXLS_Attribute("ss:Hidden", *x\Hidden))
PureXLS_WriteString(id, PureXLS_Attribute("ss:Index", *x\Index))
PureXLS_WriteString(id, PureXLS_Attribute("ss:Span", *x\Span))
PureXLS_WriteString(id, PureXLS_Attribute("ss:StyleID", *x\StyleID))
PureXLS_WriteString(id, PureXLS_Attribute("ss:Width", *x\Width))
EndIf
PureXLS_WriteStringN(id, "/>")
EndIf
EndProcedure
ProcedureDLL.l PureXLS_Row(id.l, Height.s = "", StyleID.s = "")
If IsFile(id)
PureXLS_WriteString(id, "<Row")
PureXLS_WriteString(id, PureXLS_Attribute("ss:Height", Height))
PureXLS_WriteString(id, PureXLS_Attribute("ss:StyleID", StyleID))
PureXLS_WriteStringN(id, ">")
ProcedureReturn #True
EndIf
EndProcedure
ProcedureDLL.l PureXLS_RowI(id.l, *x.PureXLS_Row = #Null)
If IsFile(id)
PureXLS_WriteString(id, "<Row")
If *x
PureXLS_WriteString(id, PureXLS_Attribute("c:Caption", *x\Caption))
PureXLS_WriteString(id, PureXLS_Attribute("ss:AutoFitHeight", *x\AutoFitHeight))
PureXLS_WriteString(id, PureXLS_Attribute("ss:Height", *x\Height))
PureXLS_WriteString(id, PureXLS_Attribute("ss:Hidden", *x\Hidden))
PureXLS_WriteString(id, PureXLS_Attribute("ss:Index", *x\Index))
PureXLS_WriteString(id, PureXLS_Attribute("ss:Span", *x\Span))
PureXLS_WriteString(id, PureXLS_Attribute("ss:StyleID", *x\StyleID))
EndIf
PureXLS_WriteStringN(id, ">")
ProcedureReturn #True
EndIf
EndProcedure
ProcedureDLL.l PureXLS_EndRow(id.l)
If IsFile(id)
PureXLS_WriteStringN(id, "</Row>")
EndIf
EndProcedure
ProcedureDLL.l PureXLS_Cell(id.l, Value.s, Type.s = "String", StyleID.s = "", Formula.s = "")
If IsFile(id)
PureXLS_WriteString(id, "<Cell")
PureXLS_WriteString(id, PureXLS_Attribute("ss:StyleID", StyleID))
PureXLS_WriteString(id, PureXLS_Attribute("ss:Formula", Formula))
PureXLS_WriteString(id, ">")
If Value<>""
PureXLS_WriteString(id, "<Data")
PureXLS_WriteString(id, PureXLS_Attribute("ss:Type", Type))
PureXLS_WriteString(id, ">")
PureXLS_WriteString(id, Value)
PureXLS_WriteStringN(id, "</Data>")
EndIf
PureXLS_WriteStringN(id, "</Cell>")
EndIf
EndProcedure
ProcedureDLL.l PureXLS_CellI(id.l, Value.s, *c.PureXLS_Cell = #Null, *d.PureXLS_Data = #Null)
If IsFile(id)
PureXLS_WriteString(id, "<Cell")
If *c
PureXLS_WriteString(id, PureXLS_Attribute("c:PasteFormula", *c\PasteFormula))
PureXLS_WriteString(id, PureXLS_Attribute("ss:ArrayRange", *c\ArrayRange))
PureXLS_WriteString(id, PureXLS_Attribute("ss:Formula", *c\Formula))
PureXLS_WriteString(id, PureXLS_Attribute("ss:HRef", *c\HRef))
PureXLS_WriteString(id, PureXLS_Attribute("ss:Index", *c\Index))
PureXLS_WriteString(id, PureXLS_Attribute("ss:MergeAcross", *c\MergeAcross))
PureXLS_WriteString(id, PureXLS_Attribute("ss:MergeDown", *c\MergeDown))
PureXLS_WriteString(id, PureXLS_Attribute("ss:StyleID", *c\StyleID))
PureXLS_WriteString(id, PureXLS_Attribute("x:HRefScreenTip", *c\HRefScreenTip))
EndIf
PureXLS_WriteString(id, ">")
If Value<>""
PureXLS_WriteString(id, "<Data")
PureXLS_WriteString(id, PureXLS_Attribute("ss:Type", *d\Type))
PureXLS_WriteString(id, PureXLS_Attribute("x:Ticked", *d\Ticked))
PureXLS_WriteString(id, ">")
PureXLS_WriteString(id, Value)
PureXLS_WriteStringN(id, "</Data>")
EndIf
PureXLS_WriteStringN(id, "</Cell>")
EndIf
EndProcedure
ProcedureDLL.s XLS_FormatDate(Date$,Format$)
If Date$
ProcedureReturn FormatDate("%yyyy-%mm-%ddT%hh:%ii:%ss.000",ParseDate(Format$,Date$))
Else
ProcedureReturn ""
EndIf
EndProcedure
;
;- END OF INCLUDE
;
DisableExplicit
; IDE Options = PureBasic 4.50 (Windows - x86)
; CursorPosition = 680
; FirstLine = 656
; Folding = --------
Code: Select all
;-
XIncludeFile "PureXLS.pbi"
;-
#OUTPUT_FILE = "sheet.xls"
doc = PureXLS_Workbook(#OUTPUT_FILE)
If doc
; Workbook -> Styles
If PureXLS_Styles(doc)
; Workbook -> Styles -> Style -> myFirstRow
If PureXLS_Style(doc, "myFirstRow")
PureXLS_Font(doc, "Arial", "10", "#000000", "1")
PureXLS_Interior(doc, "#808080", #XLS_Pattern_Solid)
PureXLS_Alignment(doc, #XLS_Horizontal_Center, #XLS_Vertical_Center)
If PureXLS_Borders(doc)
PureXLS_Border(doc, #XLS_Position_Bottom, #XLS_LineStyle_Continuous, "3", "#000000")
PureXLS_Border(doc, #XLS_Position_Left, #XLS_LineStyle_Continuous, "1")
PureXLS_Border(doc, #XLS_Position_Right, #XLS_LineStyle_Continuous, "3", "Red")
PureXLS_Border(doc, #XLS_Position_Top, #XLS_LineStyle_Continuous, "1")
PureXLS_EndBorders(doc)
EndIf
PureXLS_EndStyle(doc)
EndIf
; Workbook -> Styles -> Style -> myFirstColumn
If PureXLS_Style(doc, "myFirstColumn")
PureXLS_Font(doc, "Arial", "8", "#0000FF", "1")
PureXLS_Interior(doc, "#00FF00", #XLS_Pattern_Solid)
PureXLS_Alignment(doc, #XLS_Horizontal_Center, #XLS_Vertical_Center)
PureXLS_EndStyle(doc)
EndIf
; Workbook -> Styles -> Style -> myNumber
If PureXLS_Style(doc, "myNumber")
PureXLS_Font(doc, "Tahoma", "8", "#008800", "1")
PureXLS_Interior(doc, "#C0C0FF", #XLS_Pattern_Solid)
PureXLS_Alignment(doc, #XLS_Horizontal_Right, #XLS_Vertical_Center)
If PureXLS_Borders(doc)
PureXLS_Border(doc, #XLS_Position_Bottom, #XLS_LineStyle_DashDotDot)
PureXLS_Border(doc, #XLS_Position_Right, #XLS_LineStyle_DashDotDot)
PureXLS_EndBorders(doc)
EndIf
PureXLS_EndStyle(doc)
EndIf
PureXLS_EndStyles(doc)
EndIf
; Workbook -> Worksheet
If PureXLS_Worksheet(doc, "mySheet")
; Workbook -> Worksheet -> Table
If PureXLS_Table(doc, "100", "30")
; Workbook -> Worksheet -> Table -> Columns
PureXLS_Column(doc, "50", "myFirstColumn")
PureXLS_Column(doc, "150")
PureXLS_Column(doc, "150")
PureXLS_Column(doc, "80", "myNumber")
; Workbook -> Worksheet -> Table -> First row
If PureXLS_Row(doc, "20")
PureXLS_Cell(doc, "ID", #XLS_Type_String, "myFirstRow")
PureXLS_Cell(doc, "Software", #XLS_Type_String, "myFirstRow")
PureXLS_Cell(doc, "Author", #XLS_Type_String, "myFirstRow")
PureXLS_Cell(doc, "Price", #XLS_Type_String, "myFirstRow")
PureXLS_EndRow(doc)
EndIf
; Workbook -> Worksheet -> Table -> Populate Rows
For i = 1 To 20
If PureXLS_Row(doc, "14")
PureXLS_Cell(doc, "ID" + RSet(Str(i), 2, "0"))
PureXLS_Cell(doc, "PureBasic 4.0")
PureXLS_Cell(doc, "Fantaisie Software")
PureXLS_Cell(doc, Str(Random(100)+10), #XLS_Type_Number)
PureXLS_EndRow(doc)
EndIf
Next
If PureXLS_Row(doc, "14")
PureXLS_Cell(doc, "")
PureXLS_Cell(doc, "")
PureXLS_Cell(doc, "Average:")
PureXLS_Cell(doc, "", #XLS_Type_Number, "myNumber", "=AVERAGE(R[-20]C[0]:R[-1]C[0])")
PureXLS_EndRow(doc)
EndIf
PureXLS_EndTable(doc)
EndIf
PureXLS_EndWorksheet(doc)
EndIf
PureXLS_EndWorkbook(doc)
RunProgram(#OUTPUT_FILE)
EndIf
;-
End
2,400 lines of code (plus the script) just to parse the vbs code to run it? With less 70 lines (script and PB) I write my script to a vbs file, I run it to create csv file and then I read the csv with PB.
take a look viewtopic.php?p=504952#p504952doctorized wrote:Is there a way to read and write Excel files, .xls and/or .xlsx? I have found some older posts but nothing is working. I found reference to PureXls but all links are dead.
Hi, have you worked with this lib?HanPBF wrote:http://www.libxl.com/
It has C access.
Code: Select all
EnableExplicit
XIncludeFile "libXL_enum.pbi"
Structure STRLibXLbook
extension.s ; xls or xlsx
*bookID
sheet.i
formatWrap.i
EndStructure
Global libXLid.i = 0
Procedure.l libXLInit()
Protected DLLruta.s
DLLruta = GetPathPart(ProgramFilename()) + "libxl.dll"
libXLid = OpenLibrary(#PB_Any, DLLruta)
If libXLid = 0
MessageRequester("Open DLL error", "File 'libxl.dll' not found or not valid", #PB_MessageRequester_Error)
End
EndIf
ProcedureReturn libXLid
EndProcedure
Procedure.l libXLClose()
Protected res.l = 0
res = CloseLibrary(libXLid)
ProcedureReturn res
EndProcedure
Structure STRLibXLbook
extension.s ; xls or xlsx
*bookID
sheet.i
formatWrap.i
EndStructure
;- ========================
;- Book function declarations
;- ========================
Procedure.i xlCreateBook()
ProcedureReturn CallCFunction(libXLid, "xlCreateBookCW")
EndProcedure
Procedure.i xlCreateXMLBook()
ProcedureReturn CallCFunction(libXLid, "xlCreateXMLBookCW")
EndProcedure
Procedure.i xlBookLoad(book.i, fileName.s)
ProcedureReturn CallCFunction(libXLid, "xlBookLoadW", book, @fileName)
EndProcedure
Procedure.i xlBookSave(book.i, fileName.s)
ProcedureReturn CallCFunction(libXLid, "xlBookSaveW", book, @fileName)
EndProcedure
Procedure.i xlBookLoadRaw(book.i, fileData.s, fileSize.i)
ProcedureReturn CallCFunction(libXLid, "xlBookLoadRawW", book, @fileData, fileSize)
EndProcedure
Procedure.i xlBookSaveRaw(book.i, fileData.s, fileSize.i)
ProcedureReturn CallCFunction(libXLid, "xlBookSaveRawW", book, @fileData, fileSize)
EndProcedure
Procedure.i xlBookAddSheet(book.i, sheetName.s, initSheet.i)
ProcedureReturn CallCFunction(libXLid, "xlBookAddSheetW", book, @sheetName, initSheet)
EndProcedure
Procedure.i xlBookInsertSheet(book.i, index.i, sheetName.s, initSheet.i)
ProcedureReturn CallCFunction(libXLid, "xlBookInsertSheetW", book, index, @sheetName, initSheet)
EndProcedure
Procedure.i xlBookGetSheet(book.i, index.i)
ProcedureReturn CallCFunction(libXLid, "xlBookGetSheetW", book, index)
EndProcedure
Procedure.i xlBookSheetType(book.i, index.i)
ProcedureReturn CallCFunction(libXLid, "xlBookSheetTypeW", book, index)
EndProcedure
Procedure.i xlBookDelSheet(book.i, index.i)
ProcedureReturn CallCFunction(libXLid, "xlBookDelSheetW", book, index)
EndProcedure
Procedure.i xlBookSheetCount(book.i)
ProcedureReturn CallCFunction(libXLid, "xlBookSheetCountW", book)
EndProcedure
Procedure.i xlBookAddFormat(book.i, initFormat.i)
ProcedureReturn CallCFunction(libXLid, "xlBookAddFormatW", book, initFormat)
EndProcedure
Procedure.i xlBookAddFont(book.i, initFont.i)
ProcedureReturn CallCFunction(libXLid, "xlBookAddFontW", book, initFont)
EndProcedure
Procedure.i xlBookAddCustomNumFormat(book.i, customNumFormat.s)
ProcedureReturn CallCFunction(libXLid, "xlBookAddCustomNumFormatW", book, @customNumFormat)
EndProcedure
Procedure.l xlBookCustomNumFormat(book.i, format.i)
ProcedureReturn CallCFunction(libXLid, "xlBookCustomNumFormatW", book, format)
EndProcedure
Procedure.i xlBookFormat(book.i, index.i)
ProcedureReturn CallCFunction(libXLid, "xlBookFormatW", book, index)
EndProcedure
Procedure.i xlBookFormatSize(book.i)
ProcedureReturn CallCFunction(libXLid, "xlBookFormatSizeW", book)
EndProcedure
Procedure.i xlBookFont(book.i, index.i)
ProcedureReturn CallCFunction(libXLid, "xlBookFontW", book, index)
EndProcedure
Procedure.i xlBookFontSize(book.i)
ProcedureReturn CallCFunction(libXLid, "xlBookFontSizeW", book)
EndProcedure
Procedure.d xlBookDatePack(book.i, year.i, month.i, day.i, hour.i, minute.i, second.i, millisecond.i)
ProcedureReturn CallCFunction(libXLid, "xlBookDatePackW", book, year, month, day, hour, minute, second, millisecond)
EndProcedure
Procedure.i xlBookDateUnpack(book.i, value.d, year.i, month.i, day.i, hour.i, minute.i, second.i, millisecond.i)
ProcedureReturn CallCFunction(libXLid, "xlBookDateUnpackW", book, value, year, month, day, hour, minute, second, millisecond)
EndProcedure
Procedure.i xlBookColorPack(book.i, red.i, green.i, blue.i)
ProcedureReturn CallCFunction(libXLid, "xlBookColorPackW", book, red, green, blue)
EndProcedure
Procedure.i xlBookColorUnpack(book.i, value.i, red.i, green.i, blue.i)
ProcedureReturn CallCFunction(libXLid, "xlBookColorUnpackW", book, value, red, green, blue)
EndProcedure
Procedure.i xlBookActiveSheet(book.i)
ProcedureReturn CallCFunction(libXLid, "xlBookActiveSheetW", book)
EndProcedure
Procedure.i xlBookSetActiveSheet(book.i, index.i)
ProcedureReturn CallCFunction(libXLid, "xlBookSetActiveSheetW", book, index)
EndProcedure
Procedure.i xlBookPictureSize(book.i)
ProcedureReturn CallCFunction(libXLid, "xlBookPictureSizeW", book)
EndProcedure
Procedure.i xlBookGetPicture(book.i, index.i, picData.s, picSize.i)
ProcedureReturn CallCFunction(libXLid, "xlBookGetPictureW", book, index, @picData, picSize)
EndProcedure
Procedure.i xlBookAddPicture(book.i, filename.s)
ProcedureReturn CallCFunction(libXLid, "xlBookAddPictureW", book, @filename)
EndProcedure
Procedure.i xlBookAddPicture2(book.i, picData.s, picSize.i)
ProcedureReturn CallCFunction(libXLid, "xlBookAddPicture2W", book, @picData, picSize)
EndProcedure
Procedure.l xlBookDefaultFont(book.i, fontSize.i)
ProcedureReturn CallCFunction(libXLid, "xlBookDefaultFontW", book, fontSize)
EndProcedure
Procedure.i xlBookSetDefaultFont(book.i, fontName.s, fontSize.i)
ProcedureReturn CallCFunction(libXLid, "xlBookSetDefaultFontW", book, @fontName, fontSize)
EndProcedure
Procedure.i xlBookRefR1C1(book.i)
ProcedureReturn CallCFunction(libXLid, "xlBookRefR1C1W", book)
EndProcedure
Procedure.i xlBookSetRefR1C1(book.i, refR1C1.i)
ProcedureReturn CallCFunction(libXLid, "xlBookSetRefR1C1W", book, refR1C1)
EndProcedure
Procedure.i xlBookSetKey(book.i, keyname.s, key.s)
ProcedureReturn CallCFunction(libXLid, "xlBookSetKeyW", book, @keyname, @key)
EndProcedure
Procedure.i xlBookRgbMode(book.i)
ProcedureReturn CallCFunction(libXLid, "xlBookRgbModeW", book)
EndProcedure
Procedure.i xlBookSetRgbMode(book.i, rgbMode.i)
ProcedureReturn CallCFunction(libXLid, "xlBookSetRgbModeW", book, rgbMode)
EndProcedure
Procedure.i xlBookVersion(book.i)
ProcedureReturn CallCFunction(libXLid, "xlBookVersionW", book)
EndProcedure
Procedure.i xlBookBiffVersion(book.i)
ProcedureReturn CallCFunction(libXLid, "xlBookBiffVersionW", book)
EndProcedure
Procedure.i xlBookIsDate1904(book.i)
ProcedureReturn CallCFunction(libXLid, "xlBookIsDate1904W", book)
EndProcedure
Procedure.i xlBookSetDate1904(book.i, date1904.i)
ProcedureReturn CallCFunction(libXLid, "xlBookSetDate1904W", book, date1904)
EndProcedure
Procedure.i xlBookIsTemplate(book.i)
ProcedureReturn CallCFunction(libXLid, "xlBookIsTemplateW", book)
EndProcedure
Procedure.i xlBookSetTemplate(book.i, tmpl.i)
ProcedureReturn CallCFunction(libXLid, "xlBookSetTemplateW", book, tmpl)
EndProcedure
Procedure.i xlBookSetLocale(book.i, tmpl.s)
ProcedureReturn CallCFunction(libXLid, "xlBookSetLocaleW", book, @tmpl)
EndProcedure
Procedure.l xlBookErrorMessage(book.i)
ProcedureReturn CallCFunction(libXLid, "xlBookErrorMessageW", book)
EndProcedure
Procedure.i xlBookRelease(book.i)
ProcedureReturn CallCFunction(libXLid, "xlBookReleaseW", book)
EndProcedure
;-
;- ========================
;- Sheet function declarations
;- ========================
Procedure.i xlSheetCellType(sheet.i, row.i, col.i)
ProcedureReturn CallCFunction(libXLid, "xlSheetCellTypeW", sheet, row, col)
EndProcedure
Procedure.i xlSheetIsFormula(sheet.i, row.i, col.i)
ProcedureReturn CallCFunction(libXLid, "xlSheetIsFormulaW", sheet, row, col)
EndProcedure
Procedure.i xlSheetCellFormat(sheet.i, row.i, col.i)
ProcedureReturn CallCFunction(libXLid, "xlSheetCellFormatW", sheet, row, col)
EndProcedure
Procedure.i xlSheetSetCellFormat(sheet.i, row.i, col.i, format.i)
ProcedureReturn CallCFunction(libXLid, "xlSheetSetCellFormatW", sheet, row, col, format)
EndProcedure
Procedure.l xlSheetReadStr(sheet.i, row.i, col.i, *format)
ProcedureReturn CallCFunction(libXLid, "xlSheetReadStrW", sheet, row, col, *format)
EndProcedure
Procedure.i xlSheetWriteStr(sheet.i, row.i, col.i, value.s, format.i)
ProcedureReturn CallCFunction(libXLid, "xlSheetWriteStrW", sheet, row, col, @value, format)
EndProcedure
Procedure.d xlSheetReadNum(sheet.i, row.i, col.i, *format)
ProcedureReturn CallCFunction(libXLid, "xlSheetReadNumW", sheet, row, col, *format)
EndProcedure
Procedure.i xlSheetWriteNum(sheet.i, row.i, col.i, value.d, format.i)
ProcedureReturn CallCFunction(libXLid, "xlSheetWriteNumW", sheet, row, col, value, format)
EndProcedure
Procedure.i xlSheetReadBool(sheet.i, row.i, col.i, *format)
ProcedureReturn CallCFunction(libXLid, "xlSheetReadBoolW", sheet, row, col, *format)
EndProcedure
Procedure.i xlSheetWriteBool(sheet.i, row.i, col.i, value.i, format.i )
ProcedureReturn CallCFunction(libXLid, "xlSheetWriteBoolW", sheet, row, col, value, format)
EndProcedure
Procedure.i xlSheetReadBlank(sheet.i, row.i, col.i, *format)
ProcedureReturn CallCFunction(libXLid, "xlSheetReadBlankW", sheet, row, col, *format)
EndProcedure
Procedure.i xlSheetWriteBlank(sheet.i, row.i, col.i, format.i)
ProcedureReturn CallCFunction(libXLid, "xlSheetWriteBlankW", sheet, row, col, format)
EndProcedure
Procedure.l xlSheetReadFormula(sheet.i, row.i, col.i, *format)
ProcedureReturn CallCFunction(libXLid, "xlSheetReadFormulaW", sheet, row, col, *format)
EndProcedure
Procedure.i xlSheetWriteFormula(sheet.i, row.i, col.i, value.s, *format)
ProcedureReturn CallCFunction(libXLid, "xlSheetWriteFormulaW", sheet, row, col, @value, *format)
EndProcedure
Procedure.l xlSheetReadComment(sheet.i, row.i, col.i)
ProcedureReturn CallCFunction(libXLid, "xlSheetReadCommentW", sheet, row, col)
EndProcedure
Procedure.i xlSheetWriteComment(sheet.i, row.i, col.i, value.s, author.s, width_.i, height_.i)
ProcedureReturn CallCFunction(libXLid, "xlSheetWriteCommentW", sheet, row, col, @value, @author, width_, height_)
EndProcedure
Procedure.i xlSheetIsDate(sheet.i, row.i, col.i)
ProcedureReturn CallCFunction(libXLid, "xlSheetIsDateW", sheet, row, col)
EndProcedure
Procedure.i xlSheetReadError(sheet.i, row.i, col.i)
ProcedureReturn CallCFunction(libXLid, "xlSheetReadErrorW", sheet, row, col)
EndProcedure
Procedure.d xlSheetColWidth(sheet.i, row.i, col.i)
ProcedureReturn CallCFunction(libXLid, "xlSheetColWidthW", sheet, row, col)
EndProcedure
Procedure.d xlSheetRowHeight(sheet.i, row.i, col.i)
ProcedureReturn CallCFunction(libXLid, "xlSheetRowHeightW", sheet, row, col)
EndProcedure
Procedure.i xlSheetSetCol(sheet.i, colFirst.i, colLast.i, width.d, format.i, hidden_.i)
ProcedureReturn CallCFunction(libXLid, "xlSheetSetColW", sheet, colFirst, colLast, width, format, hidden_)
EndProcedure
Procedure.i xlSheetSetRow(sheet.i, row.i, height.d, format.i, hidden_.i)
ProcedureReturn CallCFunction(libXLid, "xlSheetSetRowW", sheet, row, height, format, hidden_)
EndProcedure
Procedure.i xlSheetRowHidden(sheet.i, row.i)
ProcedureReturn CallCFunction(libXLid, "xlSheetRowHiddenW", sheet, row)
EndProcedure
Procedure.i xlSheetSetRowHidden(sheet.i, row.i, hidden_.i)
ProcedureReturn CallCFunction(libXLid, "xlSheetSetRowHiddenW", sheet, row, hidden_)
EndProcedure
Procedure.i xlSheetColHidden(sheet.i, col.i)
ProcedureReturn CallCFunction(libXLid, "xlSheetColHiddenW", sheet, col)
EndProcedure
Procedure.i xlSheetSetColHidden(sheet.i, col.i, hidden.i)
ProcedureReturn CallCFunction(libXLid, "xlSheetSetColHiddenW", sheet, col, hidden)
EndProcedure
Procedure.i xlSheetGetMerge(sheet.i, row.i, col.i, rowFirst.i, rowLast.i, colFirst.i, colLast.i)
ProcedureReturn CallCFunction(libXLid, "xlSheetGetMergeW", sheet, row, col, rowFirst, rowLast, colFirst, colLast)
EndProcedure
Procedure.i xlSheetSetMerge(sheet.i, rowFirst.i, rowLast.i, colFirst.i, colLast.i)
ProcedureReturn CallCFunction(libXLid, "xlSheetSetMergeW", sheet, rowFirst, rowLast, colFirst, colLast)
EndProcedure
Procedure.i xlSheetDelMerge(sheet.i, row.i, col.i)
ProcedureReturn CallCFunction(libXLid, "xlSheetDelMergeW", sheet, row, col)
EndProcedure
Procedure.i xlSheetMergeSize(sheet.i)
ProcedureReturn CallCFunction(libXLid, "xlSheetMergeSizeW", sheet)
EndProcedure
Procedure.i xlSheetMerge(sheet.i, index.i, rowFirst.i, rowLast.i, colFirst.i, colLast.i)
ProcedureReturn CallCFunction(libXLid, "xlSheetMergeW", sheet, index, rowFirst, rowLast, colFirst, colLast)
EndProcedure
Procedure.i xlSheetDelMergeByIndex(sheet.i, index.i)
ProcedureReturn CallCFunction(libXLid, "xlSheetDelMergeByIndexW", sheet, index)
EndProcedure
Procedure.i xlSheetPictureSize(sheet.i)
ProcedureReturn CallCFunction(libXLid, "xlSheetPictureSizeW", sheet)
EndProcedure
Procedure.i xlSheetGetPicture(sheet.i, index.i, rowTop.i, colLeft.i, rowBottom.i, colRight.i, width.i , height.i , offset_x.i , offset_y.i)
ProcedureReturn CallCFunction(libXLid, "xlSheetGetPictureW", sheet, index, rowTop, colLeft, rowBottom, colRight, width, height, offset_x, offset_y)
EndProcedure
Procedure.i xlSheetSetPicture(sheet.i, row.i, col.i, pictureId.i, scale.d, offset_x.i, offset_y.i)
ProcedureReturn CallCFunction(libXLid, "xlSheetSetPictureW", sheet, row, col, pictureId, scale, offset_x, offset_y)
EndProcedure
Procedure.i xlSheetSetPicture2(sheet.i, row.i, col.i, pictureId.i, width.i, height.i, offset_x.i, offset_y.i)
ProcedureReturn CallCFunction(libXLid, "xlSheetSetPicture2W", sheet, row, col, pictureId, width, height, offset_x, offset_y)
EndProcedure
Procedure.i xlSheetGetHorPageBreak(sheet.i, index.i)
ProcedureReturn CallCFunction(libXLid, "xlSheetGetHorPageBreakW", sheet, index)
EndProcedure
Procedure.i xlSheetGetHorPageBreakSize(sheet.i)
ProcedureReturn CallCFunction(libXLid, "xlSheetGetHorPageBreakSizeW", sheet)
EndProcedure
Procedure.i xlSheetGetVerPageBreak(sheet.i, index.i)
ProcedureReturn CallCFunction(libXLid, "xlSheetGetVerPageBreakW", sheet, index)
EndProcedure
Procedure.i xlSheetGetVerPageBreakSize(sheet.i)
ProcedureReturn CallCFunction(libXLid, "xlSheetGetVerPageBreakSizeW", sheet)
EndProcedure
Procedure.i xlSheetSetHorPageBreak(sheet.i, row.i, pageBreak.i)
ProcedureReturn CallCFunction(libXLid, "xlSheetSetHorPageBreakW", sheet, row, pageBreak)
EndProcedure
Procedure.i xlSheetSetVerPageBreak(sheet.i, col.i, pageBreak.i)
ProcedureReturn CallCFunction(libXLid, "xlSheetSetVerPageBreakW", sheet, col, pageBreak)
EndProcedure
Procedure.i xlSheetSplit(sheet.i, row.i, col.i)
ProcedureReturn CallCFunction(libXLid, "xlSheetSplitW", sheet, row, col)
EndProcedure
Procedure.i xlSheetSplitInfo(sheet.i, row.i, col.i)
ProcedureReturn CallCFunction(libXLid, "xlSheetSplitInfoW", sheet, row, col)
EndProcedure
Procedure.i xlSheetGroupRows(sheet.i, rowFirst.i, rowLast.i, collapsed.i)
ProcedureReturn CallCFunction(libXLid, "xlSheetGroupRowsW", sheet, rowFirst, rowLast, collapsed)
EndProcedure
Procedure.i xlSheetGroupCols(sheet.i, colFirst.i, colLast.i, collapsed.i)
ProcedureReturn CallCFunction(libXLid, "xlSheetGroupColsW", sheet, colFirst, colLast, collapsed)
EndProcedure
Procedure.i xlSheetGroupSummaryBelow(sheet.i)
ProcedureReturn CallCFunction(libXLid, "xlSheetGroupSummaryBelowW", sheet)
EndProcedure
Procedure.i xlSheetSetGroupSummaryBelow(sheet.i, below.i)
ProcedureReturn CallCFunction(libXLid, "xlSheetSetGroupSummaryBelowW", sheet, below)
EndProcedure
Procedure.i xlSheetGroupSummaryRight(sheet.i)
ProcedureReturn CallCFunction(libXLid, "xlSheetGroupSummaryRightW", sheet)
EndProcedure
Procedure.i xlSheetSetGroupSummaryRight(sheet.i, right.i)
ProcedureReturn CallCFunction(libXLid, "xlSheetSetGroupSummaryRightW", sheet, right)
EndProcedure
Procedure.i xlSheetClear(sheet.i, rowFirst.i, rowLast.i, colFirst.i, colLast.i)
ProcedureReturn CallCFunction(libXLid, "xlSheetClearW", sheet, rowFirst, rowLast, colFirst, colLast)
EndProcedure
Procedure.i xlSheetInsertCol(sheet.i, colFirst.i, colLast.i)
ProcedureReturn CallCFunction(libXLid, "xlSheetInsertColW", sheet, colFirst, colLast)
EndProcedure
Procedure.i xlSheetInsertRow(sheet.i, rowFirst.i, rowLast.i)
ProcedureReturn CallCFunction(libXLid, "xlSheetInsertRowW", sheet, rowFirst, rowLast)
EndProcedure
Procedure.i xlSheetRemoveCol(sheet.i, colFirst.i, colLast.i)
ProcedureReturn CallCFunction(libXLid, "xlSheetRemoveColW", sheet, colFirst, colLast)
EndProcedure
Procedure.i xlSheetRemoveRow(sheet.i, rowFirst.i, colLast.i)
ProcedureReturn CallCFunction(libXLid, "xlSheetRemoveRowW", sheet, rowFirst, colLast)
EndProcedure
Procedure.i xlSheetCopyCell(sheet.i, rowSrc.i, colSrc.i, rowDst.i, colDst.i)
ProcedureReturn CallCFunction(libXLid, "xlSheetCopyCellW", sheet, rowSrc, colSrc, rowDst, colDst)
EndProcedure
Procedure.i xlSheetFirstRow(sheet.i)
ProcedureReturn CallCFunction(libXLid, "xlSheetFirstRowW", sheet)
EndProcedure
Procedure.i xlSheetLastRow(sheet.i)
ProcedureReturn CallCFunction(libXLid, "xlSheetLastRowW", sheet)
EndProcedure
Procedure.i xlSheetFirstCol(sheet.i)
ProcedureReturn CallCFunction(libXLid, "xlSheetFirstColW", sheet)
EndProcedure
Procedure.i xlSheetLastCol(sheet.i)
ProcedureReturn CallCFunction(libXLid, "xlSheetLastColW", sheet)
EndProcedure
Procedure.i xlSheetDisplayGridlines(sheet.i)
ProcedureReturn CallCFunction(libXLid, "xlSheetDisplayGridlinesW", sheet)
EndProcedure
Procedure.i xlSheetSetDisplayGridlines(sheet.i, show.i)
ProcedureReturn CallCFunction(libXLid, "xlSheetSetDisplayGridlinesW", sheet, show)
EndProcedure
Procedure.i xlSheetPrintGridlines(sheet.i)
ProcedureReturn CallCFunction(libXLid, "xlSheetPrintGridlinesW", sheet)
EndProcedure
Procedure.i xlSheetSetPrintGridlines(sheet.i, print.i)
ProcedureReturn CallCFunction(libXLid, "xlSheetSetPrintGridlinesW", sheet, print)
EndProcedure
Procedure.i xlSheetZoom(sheet.i)
ProcedureReturn CallCFunction(libXLid, "xlSheetZoomW", sheet)
EndProcedure
Procedure.i xlSheetSetZoom(sheet.i, zoom.i)
ProcedureReturn CallCFunction(libXLid, "xlSheetSetZoomW", sheet, zoom)
EndProcedure
Procedure.i xlSheetPrintZoom(sheet.i)
ProcedureReturn CallCFunction(libXLid, "xlSheetPrintZoomW", sheet)
EndProcedure
Procedure.i xlSheetSetPrintZoom(sheet.i, zoom.i)
ProcedureReturn CallCFunction(libXLid, "xlSheetSetPrintZoomW", sheet, zoom)
EndProcedure
Procedure.i xlSheetGetPrintFit(sheet.i, wPages.i, hPages.i)
ProcedureReturn CallCFunction(libXLid, "xlSheetGetPrintFitW", sheet, wPages, hPages)
EndProcedure
Procedure.i xlSheetSetPrintFit(sheet.i, wPages.i, hPages.i)
ProcedureReturn CallCFunction(libXLid, "xlSheetSetPrintFitW", sheet, wPages, hPages)
EndProcedure
Procedure.i xlSheetLandscape(sheet.i)
ProcedureReturn CallCFunction(libXLid, "xlSheetLandscapeW", sheet)
EndProcedure
Procedure.i xlSheetSetLandscape(sheet.i, landscape.i)
ProcedureReturn CallCFunction(libXLid, "xlSheetSetLandscapeW", sheet, landscape)
EndProcedure
Procedure.i xlSheetPaper(sheet.i)
ProcedureReturn CallCFunction(libXLid, "xlSheetPaperW", sheet)
EndProcedure
Procedure.i xlSheetSetPaper(sheet.i, paper.i)
ProcedureReturn CallCFunction(libXLid, "xlSheetSetPaperW", sheet, paper)
EndProcedure
Procedure.l xlSheetHeader(sheet.i)
ProcedureReturn CallCFunction(libXLid, "xlSheetHeaderW", sheet)
EndProcedure
Procedure.i xlSheetSetHeader(sheet.i, header.s, margin.d)
ProcedureReturn CallCFunction(libXLid, "xlSheetSetHeaderW", sheet, @header, margin)
EndProcedure
Procedure.d xlSheetHeaderMargin(sheet.i)
ProcedureReturn CallCFunction(libXLid, "xlSheetHeaderMarginW", sheet)
EndProcedure
Procedure.l xlSheetFooter(sheet.i)
ProcedureReturn CallCFunction(libXLid, "xlSheetFooterW", sheet)
EndProcedure
Procedure.i xlSheetSetFooter(sheet.i, footer.s, margin.d)
ProcedureReturn CallCFunction(libXLid, "xlSheetSetFooterW", sheet, @footer, margin)
EndProcedure
Procedure.d xlSheetFooterMargin(sheet.i, row.i, col.i)
ProcedureReturn CallCFunction(libXLid, "xlSheetFooterMarginW", sheet, row, col)
EndProcedure
Procedure.i xlSheetHCenter(sheet.i)
ProcedureReturn CallCFunction(libXLid, "xlSheetHCenterW", sheet)
EndProcedure
Procedure.i xlSheetSetHCenter(sheet.i, hCenter.i)
ProcedureReturn CallCFunction(libXLid, "xlSheetSetHCenterW", sheet, hCenter)
EndProcedure
Procedure.i xlSheetVCenter(sheet.i)
ProcedureReturn CallCFunction(libXLid, "xlSheetVCenterW", sheet)
EndProcedure
Procedure.i xlSheetSetVCenter(sheet.i, vCenter.i)
ProcedureReturn CallCFunction(libXLid, "xlSheetSetVCenterW", sheet, vCenter)
EndProcedure
Procedure.d xlSheetMarginLeft(sheet.i)
ProcedureReturn CallCFunction(libXLid, "xlSheetMarginLeftW", sheet)
EndProcedure
Procedure.i xlSheetSetMarginLeft(sheet.i, margin.d)
ProcedureReturn CallCFunction(libXLid, "xlSheetSetMarginLeftW", sheet, margin)
EndProcedure
Procedure.d xlSheetMarginRight(sheet.i)
ProcedureReturn CallCFunction(libXLid, "xlSheetMarginRightW", sheet)
EndProcedure
Procedure.i xlSheetSetMarginRight(sheet.i, margin.d)
ProcedureReturn CallCFunction(libXLid, "xlSheetSetMarginRightW", sheet, margin)
EndProcedure
Procedure.d xlSheetMarginTop(sheet.i)
ProcedureReturn CallCFunction(libXLid, "xlSheetMarginTopW", sheet)
EndProcedure
Procedure.i xlSheetSetMarginTop(sheet.i, margin.d)
ProcedureReturn CallCFunction(libXLid, "xlSheetSetMarginTopW", sheet, margin)
EndProcedure
Procedure.d xlSheetMarginBottom(sheet.i)
ProcedureReturn CallCFunction(libXLid, "xlSheetMarginBottomW", sheet)
EndProcedure
Procedure.i xlSheetSetMarginBottom(sheet.i, margin.d)
ProcedureReturn CallCFunction(libXLid, "xlSheetSetMarginBottomW", sheet, margin)
EndProcedure
Procedure.i xlSheetPrintRowCol(sheet.i)
ProcedureReturn CallCFunction(libXLid, "xlSheetPrintRowColW", sheet)
EndProcedure
Procedure.i xlSheetSetPrintRowCol(sheet.i, print.i)
ProcedureReturn CallCFunction(libXLid, "xlSheetSetPrintRowColW", sheet, print)
EndProcedure
Procedure.i xlSheetSetPrintRepeatRows(sheet.i, rowFirst.i, rowLast.i)
ProcedureReturn CallCFunction(libXLid, "xlSheetSetPrintRepeatRowsW", sheet, rowFirst, rowLast)
EndProcedure
Procedure.i xlSheetSetPrintRepeatCols(sheet.i, colFirst.i, colLast.i)
ProcedureReturn CallCFunction(libXLid, "xlSheetSetPrintRepeatColsW", sheet, colFirst, colLast)
EndProcedure
Procedure.i xlSheetSetPrintArea(sheet.i, rowFirst.i, rowLast.i, colFirst.i, colLast.i)
ProcedureReturn CallCFunction(libXLid, "xlSheetSetPrintAreaW", sheet, rowFirst, rowLast, colFirst, colLast)
EndProcedure
Procedure.i xlSheetClearPrintRepeats(sheet.i)
ProcedureReturn CallCFunction(libXLid, "xlSheetClearPrintRepeatsW", sheet)
EndProcedure
Procedure.i xlSheetClearPrintArea(sheet.i)
ProcedureReturn CallCFunction(libXLid, "xlSheetClearPrintAreaW", sheet)
EndProcedure
Procedure.i xlSheetGetNamedRange(sheet.i, rangeName.s, rowFirst.i, rowLast.i, colFirst.i, colLast.i, scopeId.i, hidden_.i )
ProcedureReturn CallCFunction(libXLid, "xlSheetGetNamedRangeW", sheet, @rangeName, rowFirst, rowLast, colFirst, colLast, scopeId, hidden_)
EndProcedure
Procedure.i xlSheetSetNamedRange(sheet.i, rangeName.s, rowFirst.i, rowLast.i, colFirst.i, colLast.i, scopeId.i)
ProcedureReturn CallCFunction(libXLid, "xlSheetSetNamedRangeW", sheet, @rangeName, rowFirst, rowLast, colFirst, colLast, scopeId)
EndProcedure
Procedure.i xlSheetDelNamedRange(sheet.i, rangeName.s, scopeId.i)
ProcedureReturn CallCFunction(libXLid, "xlSheetDelNamedRangeW", sheet, @rangeName, scopeId)
EndProcedure
Procedure.i xlSheetNamedRangeSize(sheet.i)
ProcedureReturn CallCFunction(libXLid, "xlSheetNamedRangeSizeW", sheet)
EndProcedure
Procedure.l xlSheetNamedRange(sheet.i, index.i, rowFirst.i, rowLast.i, colFirst.i, colLast.i, scopeId.i, hidden_.i )
ProcedureReturn CallCFunction(libXLid, "xlSheetNamedRangeW", sheet, index, rowFirst, rowLast, colFirst, colLast, scopeId, hidden_)
EndProcedure
Procedure.i xlSheetHyperlinkSize(sheet.i)
ProcedureReturn CallCFunction(libXLid, "xlSheetHyperlinkSizeW", sheet)
EndProcedure
Procedure.l xlSheetHyperlink(sheet.i, index.i, rowFirst.i, rowLast.i, colFirst.i, colLast.i)
ProcedureReturn CallCFunction(libXLid, "xlSheetHyperlinkW", sheet, index, rowFirst, rowLast, colFirst, colLast)
EndProcedure
Procedure.i xlSheetDelHyperlink(sheet.i, index.i)
ProcedureReturn CallCFunction(libXLid, "xlSheetDelHyperlinkW", sheet, index)
EndProcedure
Procedure.i xlSheetAddHyperlink(sheet.i, hyperlink.s, rowFirst.i, rowLast.i, colFirst.i, colLast.i)
ProcedureReturn CallCFunction(libXLid, "xlSheetAddHyperlinkW", sheet, @hyperlink, rowFirst, rowLast, colFirst, colLast)
EndProcedure
Procedure.l xlSheetName(sheet.i)
ProcedureReturn CallCFunction(libXLid, "xlSheetNameW", sheet)
EndProcedure
Procedure.i xlSheetSetName(sheet.i, sheetName.s)
ProcedureReturn CallCFunction(libXLid, "xlSheetSetNameW", sheet, @sheetName)
EndProcedure
Procedure.i xlSheetProtect(sheet.i)
ProcedureReturn CallCFunction(libXLid, "xlSheetProtectW", sheet)
EndProcedure
Procedure.i xlSheetSetProtect(sheet.i, protect.i)
ProcedureReturn CallCFunction(libXLid, "xlSheetSetProtectW", sheet, protect)
EndProcedure
Procedure.i xlSheetSetProtectEx(sheet.i, protect.i, password.s, prot.i)
ProcedureReturn CallCFunction(libXLid, "xlSheetSetProtectExW", sheet, protect, @password, prot)
EndProcedure
Procedure.i xlSheetHidden(sheet.i)
ProcedureReturn CallCFunction(libXLid, "xlSheetHiddenW", sheet)
EndProcedure
Procedure.i xlSheetSetHidden(sheet.i, hidden.i)
ProcedureReturn CallCFunction(libXLid, "xlSheetSetHiddenW", sheet, hidden)
EndProcedure
Procedure.i xlSheetGetTopLeftView(sheet.i, row.i, col.i)
ProcedureReturn CallCFunction(libXLid, "xlSheetGetTopLeftViewW", sheet, row, col)
EndProcedure
Procedure.i xlSheetSetTopLeftView(sheet.i, row.i, col.i)
ProcedureReturn CallCFunction(libXLid, "xlSheetSetTopLeftViewW", sheet, row, col)
EndProcedure
Procedure.i xlSheetRightToLeft(sheet.i)
ProcedureReturn CallCFunction(libXLid, "xlSheetRightToLeftW", sheet)
EndProcedure
Procedure.i xlSheetSetRightToLeft(sheet.i, rightToLeft.i)
ProcedureReturn CallCFunction(libXLid, "xlSheetSetRightToLeftW", sheet, rightToLeft)
EndProcedure
Procedure.i xlSheetAddrToRowCol(sheet.i, addr_.s, row.i, col.i, rowRelative.i, colRelative.i)
ProcedureReturn CallCFunction(libXLid, "xlSheetAddrToRowColW", sheet, @addr_, row, col, rowRelative, colRelative)
EndProcedure
Procedure.l xlSheetRowColToAddr(sheet.i, row.i, col.i, rowRelative.i, colRelative.i)
ProcedureReturn CallCFunction(libXLid, "xlSheetRowColToAddrW", sheet, row, col, rowRelative, colRelative)
EndProcedure
;-
;- ========================
;- Format function declarations
;- ========================
Procedure.i xlFormatFont(format.i)
ProcedureReturn CallCFunction(libXLid, "xlFormatFontW", format)
EndProcedure
Procedure.i xlFormatSetFont(format.i, font.i)
ProcedureReturn CallCFunction(libXLid, "xlFormatSetFontW", format, font)
EndProcedure
Procedure.i xlFormatNumFormat(format.i)
ProcedureReturn CallCFunction(libXLid, "xlFormatNumFormatW", format)
EndProcedure
Procedure.i xlFormatSetNumFormat(format.i, numFormat.i)
ProcedureReturn CallCFunction(libXLid, "xlFormatSetNumFormatW", format, numFormat)
EndProcedure
Procedure.i xlFormatAlignH(format.i)
ProcedureReturn CallCFunction(libXLid, "xlFormatAlignHW", format)
EndProcedure
Procedure.i xlFormatSetAlignH(format.i, align.i)
ProcedureReturn CallCFunction(libXLid, "xlFormatSetAlignHW", format, align)
EndProcedure
Procedure.i xlFormatAlignV(format.i)
ProcedureReturn CallCFunction(libXLid, "xlFormatAlignVW", format)
EndProcedure
Procedure.i xlFormatSetAlignV(format.i, align.i)
ProcedureReturn CallCFunction(libXLid, "xlFormatSetAlignVW", format, align)
EndProcedure
Procedure.i xlFormatWrap(format.i)
ProcedureReturn CallCFunction(libXLid, "xlFormatWrapW", format)
EndProcedure
Procedure.i xlFormatSetWrap(format.i, wrap.i)
ProcedureReturn CallCFunction(libXLid, "xlFormatSetWrapW", format, wrap)
EndProcedure
Procedure.i xlFormatRotation(format.i)
ProcedureReturn CallCFunction(libXLid, "xlFormatRotationW", format)
EndProcedure
Procedure.i xlFormatSetRotation(format.i, rotation.i)
ProcedureReturn CallCFunction(libXLid, "xlFormatSetRotationW", format, rotation)
EndProcedure
Procedure.i xlFormatIndent(format.i)
ProcedureReturn CallCFunction(libXLid, "xlFormatIndentW", format)
EndProcedure
Procedure.i xlFormatSetIndent(format.i, indent.i)
ProcedureReturn CallCFunction(libXLid, "xlFormatSetIndentW", format, indent)
EndProcedure
Procedure.i xlFormatShrinkToFit(format.i)
ProcedureReturn CallCFunction(libXLid, "xlFormatShrinkToFitW", format)
EndProcedure
Procedure.i xlFormatSetShrinkToFit(format.i, shrinkToFit.i)
ProcedureReturn CallCFunction(libXLid, "xlFormatSetShrinkToFitW", format, shrinkToFit)
EndProcedure
Procedure.i xlFormatSetBorder(format.i, style.i)
ProcedureReturn CallCFunction(libXLid, "xlFormatSetBorderW", format, style)
EndProcedure
Procedure.i xlFormatSetBorderColor(format.i, color.i)
ProcedureReturn CallCFunction(libXLid, "xlFormatSetBorderColorW", format, color)
EndProcedure
Procedure.i xlFormatBorderLeft(format.i)
ProcedureReturn CallCFunction(libXLid, "xlFormatBorderLeftW", format)
EndProcedure
Procedure.i xlFormatSetBorderLeft(format.i, style.i)
ProcedureReturn CallCFunction(libXLid, "xlFormatSetBorderLeftW", format, style)
EndProcedure
Procedure.i xlFormatBorderRight(format.i)
ProcedureReturn CallCFunction(libXLid, "xlFormatBorderRightW", format)
EndProcedure
Procedure.i xlFormatSetBorderRight(format.i, style.i)
ProcedureReturn CallCFunction(libXLid, "xlFormatSetBorderRightW", format, style)
EndProcedure
Procedure.i xlFormatBorderTop(format.i)
ProcedureReturn CallCFunction(libXLid, "xlFormatBorderTopW", format)
EndProcedure
Procedure.i xlFormatSetBorderTop(format.i, style.i)
ProcedureReturn CallCFunction(libXLid, "xlFormatSetBorderTopW", format, style)
EndProcedure
Procedure.i xlFormatBorderBottom(format.i)
ProcedureReturn CallCFunction(libXLid, "xlFormatBorderBottomW", format)
EndProcedure
Procedure.i xlFormatSetBorderBottom(format.i, style.i)
ProcedureReturn CallCFunction(libXLid, "xlFormatSetBorderBottomW", format, style)
EndProcedure
Procedure.i xlFormatBorderLeftColor(format.i)
ProcedureReturn CallCFunction(libXLid, "xlFormatBorderLeftColorW", format)
EndProcedure
Procedure.i xlFormatSetBorderLeftColor(format.i, color.i)
ProcedureReturn CallCFunction(libXLid, "xlFormatSetBorderLeftColorW", format, color)
EndProcedure
Procedure.i xlFormatBorderRightColor(format.i)
ProcedureReturn CallCFunction(libXLid, "xlFormatBorderRightColorW", format)
EndProcedure
Procedure.i xlFormatSetBorderRightColor(format.i, color.i)
ProcedureReturn CallCFunction(libXLid, "xlFormatSetBorderRightColorW", format, color)
EndProcedure
Procedure.i xlFormatBorderTopColor(format.i)
ProcedureReturn CallCFunction(libXLid, "xlFormatBorderTopColorW", format)
EndProcedure
Procedure.i xlFormatSetBorderTopColor(format.i, color.i)
ProcedureReturn CallCFunction(libXLid, "xlFormatSetBorderTopColorW", format, color)
EndProcedure
Procedure.i xlFormatBorderBottomColor(format.i)
ProcedureReturn CallCFunction(libXLid, "xlFormatBorderBottomColorW", format)
EndProcedure
Procedure.i xlFormatSetBorderBottomColor(format.i, color.i)
ProcedureReturn CallCFunction(libXLid, "xlFormatSetBorderBottomColorW", format, color)
EndProcedure
Procedure.i xlFormatBorderDiagonal(format.i)
ProcedureReturn CallCFunction(libXLid, "xlFormatBorderDiagonalW", format)
EndProcedure
Procedure.i xlFormatSetBorderDiagonal(format.i, border.i)
ProcedureReturn CallCFunction(libXLid, "xlFormatSetBorderDiagonalW", format, border)
EndProcedure
Procedure.i xlFormatSetBorderDiagonalColor(format.i, color.i)
ProcedureReturn CallCFunction(libXLid, "xlFormatSetBorderDiagonalColorW", format, color)
EndProcedure
Procedure.i xlFormatBorderDiagonalStyle(format.i)
ProcedureReturn CallCFunction(libXLid, "xlFormatBorderDiagonalStyleW", format)
EndProcedure
Procedure.i xlFormatSetBorderDiagonalStyle(format.i, color.i)
ProcedureReturn CallCFunction(libXLid, "xlFormatSetBorderDiagonalStyleW", format, color)
EndProcedure
Procedure.i xlFormatFillPattern(format.i)
ProcedureReturn CallCFunction(libXLid, "xlFormatFillPatternW", format)
EndProcedure
Procedure.i xlFormatSetFillPattern(format.i, pattern.i)
ProcedureReturn CallCFunction(libXLid, "xlFormatSetFillPatternW", format, pattern)
EndProcedure
Procedure.i xlFormatPatternForegroundColor(format.i)
ProcedureReturn CallCFunction(libXLid, "xlFormatPatternForegroundColorW", format)
EndProcedure
Procedure.i xlFormatSetPatternForegroundColor(format.i, color.i)
ProcedureReturn CallCFunction(libXLid, "xlFormatSetPatternForegroundColorW", format, color)
EndProcedure
Procedure.i xlFormatPatternBackgroundColor(format.i)
ProcedureReturn CallCFunction(libXLid, "xlFormatPatternBackgroundColorW", format)
EndProcedure
Procedure.i xlFormatSetPatternBackgroundColor(format.i, color.i)
ProcedureReturn CallCFunction(libXLid, "xlFormatSetPatternBackgroundColorW", format, color)
EndProcedure
Procedure.i xlFormatLocked(format.i)
ProcedureReturn CallCFunction(libXLid, "xlFormatLockedW", format)
EndProcedure
Procedure.i xlFormatSetLocked(format.i, locked.i)
ProcedureReturn CallCFunction(libXLid, "xlFormatSetLockedW", format, locked)
EndProcedure
Procedure.i xlFormatHidden(format.i)
ProcedureReturn CallCFunction(libXLid, "xlFormatHiddenW", format)
EndProcedure
Procedure.i xlFormatSetHidden(format.i, hidden.i)
ProcedureReturn CallCFunction(libXLid, "xlFormatSetHiddenW", format, hidden)
EndProcedure
;-
;- ========================
;- Format function declarations
;- ========================
Procedure.i xlFontSize(font.i)
ProcedureReturn CallCFunction(libXLid, "xlFontSizeW", font)
EndProcedure
Procedure.i xlFontSetSize(font.i, fontsize.i)
ProcedureReturn CallCFunction(libXLid, "xlFontSetSizeW", font, fontsize)
EndProcedure
Procedure.i xlFontItalic(font.i)
ProcedureReturn CallCFunction(libXLid, "xlFontItalicW", font)
EndProcedure
Procedure.i xlFontSetItalic(font.i, italic.i)
ProcedureReturn CallCFunction(libXLid, "xlFontSetItalicW", font, italic)
EndProcedure
Procedure.i xlFontStrikeOut(font.i)
ProcedureReturn CallCFunction(libXLid, "xlFontStrikeOutW", font)
EndProcedure
Procedure.i xlFontSetStrikeOut(font.i, strikeOut.i)
ProcedureReturn CallCFunction(libXLid, "xlFontSetStrikeOutW", font, strikeOut)
EndProcedure
Procedure.i xlFontColor(font.i)
ProcedureReturn CallCFunction(libXLid, "xlFontColorW", font)
EndProcedure
Procedure.i xlFontSetColor(font.i, fColor.i)
ProcedureReturn CallCFunction(libXLid, "xlFontSetColorW", font, fColor)
EndProcedure
Procedure.i xlFontBold(font.i)
ProcedureReturn CallCFunction(libXLid, "xlFontBoldW", font)
EndProcedure
Procedure.i xlFontSetBold(font.i, bold.i)
ProcedureReturn CallCFunction(libXLid, "xlFontSetBoldW", font, bold)
EndProcedure
Procedure.i xlFontScript(font.i)
ProcedureReturn CallCFunction(libXLid, "xlFontScriptW", font)
EndProcedure
Procedure.i xlFontSetScript(font.i, script.i)
ProcedureReturn CallCFunction(libXLid, "xlFontSetScriptW", font, script)
EndProcedure
Procedure.i xlFontUnderline(font.i)
ProcedureReturn CallCFunction(libXLid, "xlFontUnderlineW", font)
EndProcedure
Procedure.i xlFontSetUnderline(font.i, underline.i)
ProcedureReturn CallCFunction(libXLid, "xlFontSetUnderlineW", font, underline)
EndProcedure
Procedure.l xlFontName(Font.i)
ProcedureReturn CallCFunction(libXLid, "xlFontNameW", Font)
EndProcedure
Procedure.i xlFontSetName(font.i, fontName.s)
ProcedureReturn CallCFunction(libXLid, "xlFontSetNameW", font, @fontName)
EndProcedure
Code: Select all
; Macro BookHandle = DWORD
; Macro SheetHandle = DWORD
; Macro FormatHandle = DWORD
; Macro FontHandle = DWORD
Enumeration ;COLOR
#COLOR_BLACK = 8
#COLOR_WHITE
#COLOR_RED
#COLOR_BRIGHTGREEN
#COLOR_BLUE
#COLOR_YELLOW
#COLOR_PINK
#COLOR_TURQUOISE
#COLOR_DARKRED
#COLOR_GREEN
#COLOR_DARKBLUE
#COLOR_DARKYELLOW
#COLOR_VIOLET
#COLOR_TEAL
#COLOR_GRAY25
#COLOR_GRAY50
#COLOR_PERIWINKLE_CF
#COLOR_PLUM_CF
#COLOR_IVORY_CF
#COLOR_LIGHTTURQUOISE_CF
#COLOR_DARKPURPLE_CF
#COLOR_CORAL_CF
#COLOR_OCEANBLUE_CF
#COLOR_ICEBLUE_CF
#COLOR_DARKBLUE_CL
#COLOR_PINK_CL
#COLOR_YELLOW_CL
#COLOR_TURQUOISE_CL
#COLOR_VIOLET_CL
#COLOR_DARKRED_CL
#COLOR_TEAL_CL
#COLOR_BLUE_CL
#COLOR_SKYBLUE
#COLOR_LIGHTTURQUOISE
#COLOR_LIGHTGREEN
#COLOR_LIGHTYELLOW
#COLOR_PALEBLUE
#COLOR_ROSE
#COLOR_LAVENDER
#COLOR_TAN
#COLOR_LIGHTBLUE
#COLOR_AQUA
#COLOR_LIME
#COLOR_GOLD
#COLOR_LIGHTORANGE
#COLOR_ORANGE
#COLOR_BLUEGRAY
#COLOR_GRAY40
#COLOR_DARKTEAL
#COLOR_SEAGREEN
#COLOR_DARKGREEN
#COLOR_OLIVEGREEN
#COLOR_BROWN
#COLOR_PLUM
#COLOR_INDIGO
#COLOR_GRAY80
#COLOR_DEFAULT_FOREGROUND = 64 ;0x0040
#COLOR_DEFAULT_BACKGROUND = 65 ;0x0041
#COLOR_TOOLTIP = 81 ;0x0051
#COLOR_AUTO = 32767 ;0x7FFF
EndEnumeration
Enumeration ;NumFormat
#NUMFORMAT_GENERAL
#NUMFORMAT_NUMBER
#NUMFORMAT_NUMBER_D2
#NUMFORMAT_NUMBER_SEP
#NUMFORMAT_NUMBER_SEP_D2
#NUMFORMAT_CURRENCY_NEGBRA
#NUMFORMAT_CURRENCY_NEGBRARED
#NUMFORMAT_CURRENCY_D2_NEGBRA
#NUMFORMAT_CURRENCY_D2_NEGBRARED
#NUMFORMAT_PERCENT
#NUMFORMAT_PERCENT_D2
#NUMFORMAT_SCIENTIFIC_D2
#NUMFORMAT_FRACTION_ONEDIG
#NUMFORMAT_FRACTION_TWODIG
#NUMFORMAT_DATE
#NUMFORMAT_CUSTOM_D_MON_YY
#NUMFORMAT_CUSTOM_D_MON
#NUMFORMAT_CUSTOM_MON_YY
#NUMFORMAT_CUSTOM_HMM_AM
#NUMFORMAT_CUSTOM_HMMSS_AM
#NUMFORMAT_CUSTOM_HMM
#NUMFORMAT_CUSTOM_HMMSS
#NUMFORMAT_CUSTOM_MDYYYY_HMM
#NUMFORMAT_NUMBER_SEP_NEGBRA = 37
#NUMFORMAT_NUMBER_SEP_NEGBRARED
#NUMFORMAT_NUMBER_D2_SEP_NEGBRA
#NUMFORMAT_NUMBER_D2_SEP_NEGBRARED
#NUMFORMAT_ACCOUNT
#NUMFORMAT_ACCOUNTCUR
#NUMFORMAT_ACCOUNT_D2
#NUMFORMAT_ACCOUNT_D2_CUR
#NUMFORMAT_CUSTOM_MMSS
#NUMFORMAT_CUSTOM_H0MMSS
#NUMFORMAT_CUSTOM_MMSS0
#NUMFORMAT_CUSTOM_000P0E_PLUS0
#NUMFORMAT_TEXT
EndEnumeration
Enumeration ; AlignH
#ALIGNH_GENERAL
#ALIGNH_LEFT
#ALIGNH_CENTER
#ALIGNH_RIGHT
#ALIGNH_FILL
#ALIGNH_JUSTIFY
#ALIGNH_MERGE
#ALIGNH_DISTRIBUTED
EndEnumeration
Enumeration ;AlignV
#ALIGNV_TOP
#ALIGNV_CENTER
#ALIGNV_BOTTOM
#ALIGNV_JUSTIFY
#ALIGNV_DISTRIBUTED
EndEnumeration
Enumeration ;BorderStyle
#BORDERSTYLE_NONE
#BORDERSTYLE_THIN
#BORDERSTYLE_MEDIUM
#BORDERSTYLE_DASHED
#BORDERSTYLE_DOTTED
#BORDERSTYLE_THICK
#BORDERSTYLE_DOUBLE
#BORDERSTYLE_HAIR
#BORDERSTYLE_MEDIUMDASHED
#BORDERSTYLE_DASHDOT
#BORDERSTYLE_MEDIUMDASHDOT
#BORDERSTYLE_DASHDOTDOT
#BORDERSTYLE_MEDIUMDASHDOTDOT
#BORDERSTYLE_SLANTDASHDOT
EndEnumeration
Enumeration ;BorderDiagonal
#BORDERDIAGONAL_NONE
#BORDERDIAGONAL_DOWN
#BORDERDIAGONAL_UP
#BORDERDIAGONAL_BOTH
EndEnumeration
Enumeration ;FillPattern
#FILLPATTERN_NONE
#FILLPATTERN_SOLID
#FILLPATTERN_GRAY50
#FILLPATTERN_GRAY75
#FILLPATTERN_GRAY25
#FILLPATTERN_HORSTRIPE
#FILLPATTERN_VERSTRIPE
#FILLPATTERN_REVDIAGSTRIPE
#FILLPATTERN_DIAGSTRIPE
#FILLPATTERN_DIAGCROSSHATCH
#FILLPATTERN_THICKDIAGCROSSHATCH
#FILLPATTERN_THINHORSTRIPE
#FILLPATTERN_THINVERSTRIPE
#FILLPATTERN_THINREVDIAGSTRIPE
#FILLPATTERN_THINDIAGSTRIPE
#FILLPATTERN_THINHORCROSSHATCH
#FILLPATTERN_THINDIAGCROSSHATCH
#FILLPATTERN_GRAY12P5
#FILLPATTERN_GRAY6P25
EndEnumeration
Enumeration ;Script
#SCRIPT_NORMAL
#SCRIPT_SUPER
#SCRIPT_SUB
EndEnumeration
Enumeration ;Underline
#UNDERLINE_NONE
#UNDERLINE_SINGLE
#UNDERLINE_DOUBLE
#UNDERLINE_SINGLEACC = 33
#UNDERLINE_DOUBLEACC = 34
EndEnumeration
Enumeration ;SheetType
#SHEETTYPE_SHEET
#SHEETTYPE_CHART
#SHEETTYPE_UNKNOWN
EndEnumeration
Enumeration ;CellType
#CELLTYPE_EMPTY
#CELLTYPE_NUMBER
#CELLTYPE_STRING
#CELLTYPE_BOOLEAN
#CELLTYPE_BLANK
#CELLTYPE_ERROR
EndEnumeration
;ErrorType
#ERRORTYPE_NULL = 0
#ERRORTYPE_DIV_0 = 7
#ERRORTYPE_VALUE = 15
#ERRORTYPE_REF = 23
#ERRORTYPE_NAME = 29
#ERRORTYPE_NUM = 36
#ERRORTYPE_NA = 42
#ERRORTYPE_NOERROR = 255
Enumeration ;PictureType
#PICTURETYPE_PNG
#PICTURETYPE_JPEG
#PICTURETYPE_WMF
#PICTURETYPE_DIB
#PICTURETYPE_EMF
#PICTURETYPE_PICT
#PICTURETYPE_TIFF
#PICTURETYPE_ERROR = 255
EndEnumeration
Enumeration ;SheetState
#SHEETSTATE_VISIBLE
#SHEETSTATE_HIDDEN
#SHEETSTATE_VERYHIDDEN
EndEnumeration
;Scope
#SCOPE_UNDEFINED = -2
#SCOPE_WORKBOOK = -1
Enumeration ;PAPER
#PAPER_DEFAULT
#PAPER_LETTER
#PAPER_LETTERSMALL
#PAPER_TABLOID
#PAPER_LEDGER
#PAPER_LEGAL
#PAPER_STATEMENT
#PAPER_EXECUTIVE
#PAPER_A3
#PAPER_A4
#PAPER_A4SMALL
#PAPER_A5
#PAPER_B4
#PAPER_B5
#PAPER_FOLIO
#PAPER_QUATRO
#PAPER_10x14
#PAPER_10x17
#PAPER_NOTE
#PAPER_ENVELOPE_9
#PAPER_ENVELOPE_10
#PAPER_ENVELOPE_11
#PAPER_ENVELOPE_12
#PAPER_ENVELOPE_14
#PAPER_C_SIZE
#PAPER_D_SIZE
#PAPER_E_SIZE
#PAPER_ENVELOPE_DL
#PAPER_ENVELOPE_C5
#PAPER_ENVELOPE_C3
#PAPER_ENVELOPE_C4
#PAPER_ENVELOPE_C6
#PAPER_ENVELOPE_C65
#PAPER_ENVELOPE_B4
#PAPER_ENVELOPE_B5
#PAPER_ENVELOPE_B6
#PAPER_ENVELOPE
#PAPER_ENVELOPE_MONARCH
#PAPER_US_ENVELOPE
#PAPER_FANFOLD
#PAPER_GERMAN_STD_FANFOLD
#PAPER_GERMAN_LEGAL_FANFOLD
#PAPER_B4_ISO
#PAPER_JAPANESE_POSTCARD
#PAPER_9x11
#PAPER_10x11
#PAPER_15x11
#PAPER_ENVELOPE_INVITE
#PAPER_US_LETTER_EXTRA = 50
#PAPER_US_LEGAL_EXTRA
#PAPER_US_TABLOID_EXTRA
#PAPER_A4_EXTRA
#PAPER_LETTER_TRANSVERSE
#PAPER_A4_TRANSVERSE
#PAPER_LETTER_EXTRA_TRANSVERSE
#PAPER_SUPERA
#PAPER_SUPERB
#PAPER_US_LETTER_PLUS
#PAPER_A4_PLUS
#PAPER_A5_TRANSVERSE
#PAPER_B5_TRANSVERSE
#PAPER_A3_EXTRA
#PAPER_A5_EXTRA
#PAPER_B5_EXTRA
#PAPER_A2
#PAPER_A3_TRANSVERSE
#PAPER_A3_EXTRA_TRANSVERSE
#PAPER_JAPANESE_DOUBLE_POSTCARD
#PAPER_A6
#PAPER_JAPANESE_ENVELOPE_KAKU2
#PAPER_JAPANESE_ENVELOPE_KAKU3
#PAPER_JAPANESE_ENVELOPE_CHOU3
#PAPER_JAPANESE_ENVELOPE_CHOU4
#PAPER_LETTER_ROTATED
#PAPER_A3_ROTATED
#PAPER_A4_ROTATED
#PAPER_A5_ROTATED
#PAPER_B4_ROTATED
#PAPER_B5_ROTATED
#PAPER_JAPANESE_POSTCARD_ROTATED
#PAPER_DOUBLE_JAPANESE_POSTCARD_ROTATED
#PAPER_A6_ROTATED
#PAPER_JAPANESE_ENVELOPE_KAKU2_ROTATED
#PAPER_JAPANESE_ENVELOPE_KAKU3_ROTATED
#PAPER_JAPANESE_ENVELOPE_CHOU3_ROTATED
#PAPER_JAPANESE_ENVELOPE_CHOU4_ROTATED
#PAPER_B6
#PAPER_B6_ROTATED
#PAPER_12x11
#PAPER_JAPANESE_ENVELOPE_YOU4
#PAPER_JAPANESE_ENVELOPE_YOU4_ROTATED
#PAPER_PRC16K
#PAPER_PRC32K
#PAPER_PRC32K_BIG
#PAPER_PRC_ENVELOPE1
#PAPER_PRC_ENVELOPE2
#PAPER_PRC_ENVELOPE3
#PAPER_PRC_ENVELOPE4
#PAPER_PRC_ENVELOPE5
#PAPER_PRC_ENVELOPE6
#PAPER_PRC_ENVELOPE7
#PAPER_PRC_ENVELOPE8
#PAPER_PRC_ENVELOPE9
#PAPER_PRC_ENVELOPE10
#PAPER_PRC16K_ROTATED
#PAPER_PRC32K_ROTATED
#PAPER_PRC32KBIG_ROTATED
#PAPER_PRC_ENVELOPE1_ROTATED
#PAPER_PRC_ENVELOPE2_ROTATED
#PAPER_PRC_ENVELOPE3_ROTATED
#PAPER_PRC_ENVELOPE4_ROTATED
#PAPER_PRC_ENVELOPE5_ROTATED
#PAPER_PRC_ENVELOPE6_ROTATED
#PAPER_PRC_ENVELOPE7_ROTATED
#PAPER_PRC_ENVELOPE8_ROTATED
#PAPER_PRC_ENVELOPE9_ROTATED
#PAPER_PRC_ENVELOPE10_ROTATED
EndEnumeration
;EnhancedProtection
#PROT_DEFAULT = -1
#PROT_ALL = 0
#PROT_OBJECTS = 1
#PROT_SCENARIOS = 2
#PROT_FORMAT_CELLS = 4
#PROT_FORMAT_COLUMNS = 8
#PROT_FORMAT_ROWS = 16
#PROT_INSERT_COLUMNS = 32
#PROT_INSERT_ROWS = 64
#PROT_INSERT_HYPERLINKS = 128
#PROT_DELETE_COLUMNS = 256
#PROT_DELETE_ROWS = 512
#PROT_SEL_LOCKED_CELLS = 1024
#PROT_SORT = 2048
#PROT_AUTOFILTER = 4096
#PROT_PIVOTTABLES = 8192
#PROT_SEL_UNLOCKED_CELLS = 16384