Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

How to package vbscript ms owc

2025-01-14 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >

Share

Shulou(Shulou.com)06/03 Report--

Editor to share with you how to seal vbscript ms owc, I believe that most people do not know much about it, so share this article for your reference, I hope you can learn a lot after reading this article, let's go to know it!

The code is as follows:

'' owc.vbs

Class owc

Private o

'pass in the object

Public property set set_obj (o_id)

Set o=o_id

End property

'draw a rectangle

'The background color of the chart_bgcolor_ chart

'The title of the chartCaption_ chart

'chartCaption_fontColor_ Chart title Color

The fill color inside the Interior_Color_ rectangle

'name of Caption_

'Array of categories_ names

'Array string of values_ values

Public sub bar (chart_bgcolor_,chartCaption_,chartCaption_fontColor_,Interior_Color_,Caption_,categories_,values_)

O.Clear

Set cht = o.Charts.Add

Set c = o.Constants

Cht.Type = c.chChartTypeColumnClustered

'set the background color or fill it

O.Charts (0). PlotArea.Interior.SetSolid chart_bgcolor_

'add the title of the chart

O.HasChartSpaceTitle = True

Set cst=o.ChartSpaceTitle

Cst.Caption = chartCaption_

Cst.Font.Color = chartCaption_fontColor_

Cst.Font.Italic = False

Cst.Font.Name = "Arial"

Cst.Font.Size = 12

Cst.Font.Underline = c.owcUnderlineStyleSingle

'add data

Cht.SetData c.chDimCategories, c.chDataLiteral, categories_

Cht.SeriesCollection (0). SetData c.chDimValues, c.chDataLiteral, values_

'set the background color of the straight bar

Set sc=o.Charts (0) .SeriesCollection (0)

Sc.Interior.Color=Interior_Color_

'display settings on the straight bar

Sc.Caption=Caption_

Set dl = cht.SeriesCollection (0). DataLabelsCollection.Add

Dl.HasValue = True

Dl.HasPercentage = False

Dl.Font.Size = 9

Dl.Font.Color = "red"

Dl.Position = c.chLegendPositionRight

Dl.NumberFormat = "00.00%"

'property settings for the percentage on the left

Set cta = cht.Axes (c.chAxisPositionLeft)

Cta.Font.Size = 9

Cta.NumberFormat = "0.0%"

Cta.MajorUnit = 0.1

End sub

'Multi-series rectangular diagrams

'The background color of the chart_bgColor_ chart

'The title of the chartCaption_ chart

'chartCaption_fontColor_ Chart title Color

'Array of color_ colors

'Array of caption_ names

'Array of categories_ names

'Array of values_ values

Public sub serBar (chart_bgColor_,chartCaption_,chartCaption_fontColor_,color_,caption_,categories_,values_)

O.Clear

O.Charts.Add

Set c = o.Constants

'Type of chart

O.Charts (0). Type=c.chChartTypeColumnClustered

'add background color to the drawing area

O.Charts (0). PlotArea.Interior.SetSolid chart_bgColor_

Add the title of the chart

O.HasChartSpaceTitle = True

O.ChartSpaceTitle.Caption = chartCaption_

'attributes of the title

O.ChartSpaceTitle.Font.Color = chartCaption_fontColor_

O.ChartSpaceTitle.Font.Italic = False

O.ChartSpaceTitle.Font.Name = "Arial"

O.ChartSpaceTitle.Font.Size = 12

O.ChartSpaceTitle.Font.Underline = c.owcUnderlineStyleSingle

'use loops to add SeriesCollection and its contents

For iTun0 to ubound (caption_)

Valuetemp= ""

For j = I * (ubound (categories_) + 1) to (iTun1) * (ubound (categories_) + 1)-1

Valuetemp = valuetemp & "," & values_ (j)

Next

Valuearr = split (mid (valuetemp,2), ",")

O.Charts (0). SeriesCollection.Add

O.Charts (0) .SeriesCollection (I) .Caption = caption_ (I)

O.Charts (0) .SeriesCollection (I) .Interior.Color = color_ (I)

O.Charts (0) .SeriesCollection (I) .SetData c.chDimCategories, c.chDataLiteral, categories_

O.Charts (0) .SeriesCollection (I) .SetData c.chDimValues, c.chDataLiteral, valuearr

Set dl = o.Charts (0) .SeriesCollection (I) .DataLabelsCollection.Add

Dl.HasValue = True

Dl.HasPercentage = False

Dl.Font.Size = 9

Dl.Font.Color = "red"

Dl.Position = c.chLegendPositionRight

Dl.NumberFormat = "00.00%"

Next

The setting of the legend

O.Charts (0) .HasLegend = True

O.Charts (0). Legend.Font.Size = 9

O.Charts (0) .Legend.Position = c.chLegendPositionBottom

'' property settings for the percentage on the left

Set cta = o.Charts (0) .Axes (c.chAxisPositionLeft)

Cta.Font.Size = 9

Cta.NumberFormat = "0.005%"

Cta.MajorUnit = 0.1

End sub

'draw a round pie chart

'add background color to the chart_bgColor_ drawing area

'The title of the chartCaption_ chart

'chartCaption_fontColor_ Chart title Color

Public sub Pie (chart_bgColor_,chartCaption_,chartCaption_fontColor_,Caption_,categories_,values_)

O.Clear

Set cht = o.Charts.Add

Set c = o.Constants

Cht.Type = c.chChartTypePie3d

'add background color to the drawing area

O.Charts (0). PlotArea.Interior.SetSolid chart_bgColor_

Cht.ExtrudeAngle = 90

Cht.ChartDepth = 169,

Cht.AspectRatio = 120

Cht.Rotation = 180

Cht.Inclination=70

O.HasChartSpaceTitle = True

O.ChartSpaceTitle.Caption = chartCaption_

O.ChartSpaceTitle.Font.Color = chartCaption_fontColor_

O.ChartSpaceTitle.Font.Name = "Arial"

O.ChartSpaceTitle.Font.Size = 12

O.ChartSpaceTitle.Font.Underline = c.owcUnderlineStyleSingle

Cht.HasLegend = True

Cht.Legend.Font.Size = 9

Cht.Legend.Position = c.chLegendPositionBottom

Cht.SetData c.chDimCategories, c.chDataLiteral, categories_

Cht.SeriesCollection (0). SetData c.chDimValues, c.chDataLiteral, values_

Set sc=o.Charts (0) .SeriesCollection (0)

Sc.Caption=Caption_

Set dl = cht.SeriesCollection (0). DataLabelsCollection.Add

Dl.Separator = ":"

Dl.HasValue = false

Dl.HasSeriesName = false

Dl.HasCategoryName=true

Dl.HasPercentage = true

Dl.Font.Size = 9

Dl.Font.Color = "red"

Dl.NumberFormat = "00.00%"

End sub

'disassemble the chart

'add background color to the chart_bgColor_ drawing area

'The title of the chartCaption_ chart

'chartCaption_fontColor_ Chart title Color

Public sub line (chart_bgColor_,chartCaption_,chartCaption_fontColor_,Caption_,categories_,values_)

O.Clear

Set cht = o.Charts.Add

Set c = o.Constants

Cht.Type = c.chChartTypeLineMarkers

'add background color to the drawing area

O.Charts (0). PlotArea.Interior.SetSolid chart_bgColor_

O.HasChartSpaceTitle = True

O.ChartSpaceTitle.Caption = chartCaption_

O.ChartSpaceTitle.Font.Color = chartCaption_fontColor_

O.ChartSpaceTitle.Font.Name = "Arial"

O.ChartSpaceTitle.Font.Size = 12

O.ChartSpaceTitle.Font.Underline = c.owcUnderlineStyleSingle

Cht.SetData c.chDimCategories, c.chDataLiteral, categories_

Cht.SeriesCollection (0). SetData c.chDimValues, c.chDataLiteral, values_

Set sc=o.Charts (0) .SeriesCollection (0)

Sc.Caption=Caption_

Set dl = cht.SeriesCollection (0). DataLabelsCollection.Add

Dl.HasValue = True

Dl.HasPercentage = False

Dl.Font.Size = 9

Dl.Font.Color = "red"

Set categoryAxis = cht.Axes (c.chAxisPositionBottom)

CategoryAxis.Font.Size = 9

Set categoryAxis = cht.Axes (c.chAxisPositionLeft)

CategoryAxis.Font.Size = 9

End sub

'Multi-series disassembly chart

'The background color of the chart_bgColor_ chart

'The title of the chartCaption_ chart

'chartCaption_fontColor_ Chart title Color

'Array of color_ colors

'Array of caption_ names

'Array of categories_ names

'Array of values_ values

Public sub serLine (chart_bgColor_,chartCaption_,chartCaption_fontColor_,color_,SeriesNames_,categories_,values_)

O.Clear

Set cht = o.Charts.Add

Set c = o.Constants

'set the chart type

Cht.Type = c.chChartTypeLineMarkers

'add background color to the drawing area

O.Charts (0). PlotArea.Interior.Color=chart_bgColor_

'add the title.

O.HasChartSpaceTitle = True

O.ChartSpaceTitle.Caption = chartCaption_

O.ChartSpaceTitle.Font.Color = chartCaption_fontColor_

O.ChartSpaceTitle.Font.Name = "Arial"

O.ChartSpaceTitle.Font.Size = 12

'' add data

Cht.SetData c.chDimSeriesNames, c.chDataLiteral, SeriesNames_

Cht.SetData c.chDimCategories, c.chDataLiteral, Categories_

Set categoryAxis = cht.Axes (c.chAxisPositionBottom)

CategoryAxis.Font.Size = 9

Set categoryAxis = cht.Axes (c.chAxisPositionLeft)

CategoryAxis.Font.Size = 9

For I = 0 to ubound (SeriesNames_)

Valuetemp = ""

For j = I * (ubound (Categories_) + 1) to (iTun1) * (ubound (Categories_) + 1)-1

Valuetemp = valuetemp & "," & values_ (j)

Next

Valuearr = split (mid (valuetemp,2), ",")

Cht.SeriesCollection (I). SetData c.chDimValues, c.chDataLiteral, valuearr

Cht.SeriesCollection (I) .Line.Color = color_ (I)

Cht.SeriesCollection (I) .Line.Weight = c.owcLineWeightThin

Cht.SeriesCollection (I) .Marker.Style = c.chMarkerStyleDiamond

Cht.SeriesCollection (I) .Interior.Color = color_ (I)

Set dl = cht.SeriesCollection (I) .DataLabelsCollection.Add

Dl.HasValue = true

Dl.HasPercentage = false

Dl.Font.Size = 9

Dl.font.color= "red"

Next

End sub

'clear the pattern

Public sub clear ()

O.Clear

End sub

End class

Use the test code:

The copy code is as follows:

Vbscript owc class test

Sub window_onload ()

Set t = new owc

Categories = Array ("A2-1", "A2-2", "A2-3", "A3-1", "A3-2", "A3-3" _

, "B2-1", "B2-2", "B2-3", "B3-1", "B3-2", "B3-3" _

, "C2-1", "C2-2", "C3-1", "C3-2", "C3-3")

Values = Array (0.813, 0.689, 0.800, 0.833, 0.681, 0.864, 0.743 _

, 0.894,0.822,0.874,0.746,0.908,0.850_

, 0.728, 0.731, 0.734, 0.624)

Set t.set_obj=document.getElementById ("cs1")

T.bar "# FFFFFF", "report title", "BLUE", "# CCCC00", "Group", categories,values

Color=Array ("# CCFFFF", "# 99CCFF", "# 00CCFF", "# FF0000", "# 660066", "# FF8080")

Caption=Array ("week 1", "week 2", "week 3", "week 4")

Categories=Array ("A building", "B building")

Values=Array (0.6951, 0.5798, 0.7075, 0.512, 0.7907, 0.7493, 0.8691, 0.7716)

Set t.set_obj=document.getElementById ("cs2")

T.serbar "# FFFFFF", "Comparative Chart of floor completion rate of each week of Kengtou No. 3 Factory in October 2008", "red", color,caption,categories,values

Categories=array ("Taipei", "Shanghai")

Values = array (238760, 912560.62)

Set t.set_obj=document.getElementById ("cs3")

T.Pie "# FFFFFF", "percentage of sales amount (city classification)", "BLUE", "city", categories,values

Categories = array ("2008-11-1", "2008-11-2", "2008-11-3", "2008-11-4", "2008-11-5", "2008-11-6", "2008-11-7", "2008x11gam8", "2008x11gamet9", "2008gamel11lemagen10", "2008gamel11games11", "2008gamel11Uniexus 12", "2008gamel11lem13", "2008gamel11lem14", "2008gamel11lem15", "2008gamel1116". "2008-11-17", "2008-11-18", "2008-11-19", "2008-11-20", "2008-11-21", "2008-11-21", "2008-11-22", "2008-11-23", "2008gamel11 Master24", "2008gamel11games25", "2008gamel11games26", "2008gamel11games27", "2008gamel11games28", "2008planc11ly29", "2008gamel11plains")

Values = array (67239.89, 60400.26, 7202.89, 18453.12, 28889.29, 102136.25, 78826.39, 146291.6, 93743.29, 44204.4, 45349.28, 50730.6, 37900.21, 84359.87, 169333.62, 114594.96, 75334.7, 51360.32, 55853.05, 37912.6, 45068.22, 639399892993.71.186, 24714.534792.91, 24714,534792.91,

Set t.set_obj=document.getElementById ("cs4")

T.line "# FFFFFF", "sales amount", "BLUE", "date", categories,values

Color=Array ("# CCFFFF", "# 99CCFF", "# 00CCFF", "# FF0000")

SeriesNames = array ("A product", "B product", "C product", "D product")

Categories = array ("2005-3-24", "2005-3-25", "2005-3-26", "2005-3-27", "2005-3-28")

Values = array (50, 100, 20, 80, 80, 80, 40, 60, 90, 70, 70, 50, 55, 25, 60, 80, 50, 50, 55, 25, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, and 50).

Set t.set_obj=document.getElementById ("cs5")

T.serline "# FFFFFF", "monthly report of achievement rate", "red", color,SeriesNames,categories,values

Set t=nothing

End sub

What is owc?

Office Web Components is a group of COM controls designed to provide interactive spreadsheet modeling, data reporting and data visualization for many control containers. The OWC library consists of four main components: spreadsheet component, chart component, PivotTable component and data source component.

The word "Office" in the name "Office Web Components" means that these controls were developed by some of the programmers who developed Microsoft Excel and Access, and they are designed to look, feel, and behave like a stripped-down version of their Microsoft Office brothers. These controls really don't contain all the features in Excel and Access-in other words, you don't dynamically download the full Excel and Access to view a report in a browser, and they do contain a lot of common features, especially those necessary to interact with existing content. In addition, these controls can read and write files in HTML format of Excel 2000, allowing users to click a button to load current data into Excel for more powerful analysis.

The above is all the contents of this article "how to seal vbscript ms owc". Thank you for reading! I believe we all have a certain understanding, hope to share the content to help you, if you want to learn more knowledge, welcome to follow the industry information channel!

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Development

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report