Positioning .inlineshapes/shapes in MS word? - ms-word

I'm trying to place a logo near the text in the header. I'm able to resize it. However, I'm having a very difficult time positionining it anywhere (preferaby LEFT and TOP) would work. here is the code I have. It dumps the image far int he left top corner and I have no idea how to move it. Do I have to convert it to shape before being able to move it?
Dim SHP As InlineShape
'Dim SHP As Shape
With w_Wrd.Selection
.Font.Reset
.Font.Bold = True
.Font.Color = wdColorBlack
.Font.Name = "Times New Roman"
.Font.Size = 14
.ParagraphFormat.Alignment = wdAlignParagraphCenter
.TypeText " Needs Assessment/Family Care Plan NA/FCP "
End With
Set SHP = w_Wrd.Selection.InlineShapes.AddPicture(FileName:="Q:\IS\CEDAR\letetrhead.png", _
LinkToFile:=False, _
SaveWithDocument:=True)
With SHP
.Height = InchesToPoints(0.8)
.Width = InchesToPoints(1.3)
.ConvertToShape
End With

Related

How to get value at a point of line extended - TradingView Pine script

Im using the code below to draw a line:
//#version=4
simplesma = sma(close, 14)
var line3 = line.new(bar_index[0], high[0], bar_index, low, extend = extend.right)
line.set_xy1(line3, bar_index[5], simplesma[5])
line.set_xy2(line3, bar_index[3], simplesma[3])
That line has been drawn using 2 points in the history.
And then I use this code to draw a plot
price_point = line.get_price(line3,bar_index)
plot(price_point, title='Price', color=#ffcc00, transp=30)
Im trying to display the value on a label but the following code does not work:
var label3 = label.new(bar_index, high, text = "Value: "+ tostring(price_point, "#.########"), style = label.style_label_lower_left, color=#ffcc00, textcolor=#ff0000)
label.set_xy(label3,bar_index, price_point)
Can you please help me to show it on label ?
The variable price_point is the value at the current bar (bar_index). You don't need to use the function tostring().
Oh I found it.
var label3 = label.new(bar_index, high, text = "", style = label.style_label_lower_left, color=#ffcc00, textcolor=#ff0000)
label.set_xy(label3,bar_index, price_point)
label.set_text(label3, "Value: "+ tostring(price_point, "#.########"))

Gmap.Net save image around selected marker

I have an application with GMap.Net showing various markers. I know how to take a screen shot of the current map and markers:
Dim sImageName As String = DateTime.Now.ToString(Format("yyyyMMdd-HHmmss")) & ".png"
Dim ThisMap As New Bitmap(Form2.myMap.Width, Form2.myMap.Height)
Form2.myMap.DrawToBitmap(ThisMap, New Rectangle(0, 0, Form2.myMap.Width, Form2.myMap.Height))
ThisMap.Save(sImagesFolder & sImageName)
What I would like to do is create an image for a selected marker. Instead of the image being the entire map shown on screen, it would center on the marker and show 100 pixels in each direction.
Does anyone know how to do that?
This is what I tried, but it gives me a blank image-- nothing shows up. I feel like this should be working...
Private Sub MyMap_OnMarkerClick(item As GMapMarker, e As Windows.Forms.MouseEventArgs) Handles myMap.OnMarkerClick
SelMarkerX = e.X
SelMarkerY = e.Y
Dim sImageName As String = DateTime.Now.ToString(Format("yyyyMMdd-HHmmss")) & ".png"
Dim ThisMap As New Bitmap(140,100)
myMap.DrawToBitmap(ThisMap, New Rectangle(SelMarkerX - 70, SelMarkerY - 50, 140, 100))
ThisMap.Save(sImagesFolder & sImageName)
End Sub
I just don't get it. If I write:
myMap.DrawToBitmap(ThisMap, New Rectangle(0, 0, 140, 100)
then I get what you might expect. I get the upper left corner of the existing map from 0 to 140 horizontally and 0 to 100 vertically. If I change it to this:
myMap.DrawToBitmap(ThisMap, New Rectangle(10, 0, 140, 100)
then I get 0 to 130 horizontally and not 10 to 140.
Well, I couldn't figure out how to do it with Gmap, so I wondered if I could crop it outside of Gmap and apparently that is common. Here is the code I used.
Dim ThisMap As New Bitmap(Form2.myMap.Width, Form2.myMap.Height)
Form2.myMap.DrawToBitmap(ThisMap, New Rectangle(0, 0, Form2.myMap.Width, Form2.myMap.Height))
ThisMap.Save(sImagesFolder & sImageName)
Dim LocX = SelMarkerX - 160 'x cord. of where crop starts
Dim LocY = SelMarkerY - 120 'y cord. of where crop starts
Dim CropW = 320 'Crop width
Dim CropH = 240 'Crop height
Dim CropRect As New Rectangle(LocX, LocY, CropW, CropH)
Dim OriginalImage = ThisMap
Dim CropImage = New Bitmap(CropRect.Width, CropRect.Height)
Using grp = Graphics.FromImage(CropImage)
grp.DrawImage(OriginalImage, New Rectangle(0, 0, CropRect.Width, CropRect.Height), CropRect, GraphicsUnit.Pixel)
CropImage.Save(sImagesFolder & sImageName)
End Using

How do I maximize the window to multiple monitors in awesome wm?

I have three monitors in a horizontal line. Sometimes i want to maximize a window to three monitors at once, by pressing a combination of keys (and then returning it all back if necessary). How can I do that?
Untested, but the basic idea is to make the window floating and resize it to cover everything:
function(c)
c.floating = true
local geo = screen[1].geometry
geo.x2 = geo.x + geo.width
geo.y2 = geo.y + geo.height
for s in screen do
local geo2 = s.geometry
geo.x = math.min(geo.x, geo2.x)
geo.y = math.min(geo.y, geo2.y)
geo.x2 = math.max(geo.x2, geo2.x + geo2.width)
geo.y2 = math.max(geo.y2, geo2.y + geo2.height)
end
c:geometry{
x = geo.x,
y = geo.y,
width = geo.x2 - geo.x,
height = geo.y2 - geo.y
}
end
To undo the above, make the client no longer floating, i.e. c.floating = false.
Wiring the above to a keybinding is left as an exercise for the reader.

OOo Basic: PieChart, how to change the colour of the graph

I am writing a macro to generate pie chart in OpenOffice Basic but I can't find the method to change the colour of the different part of the pie.
We can take as example the macro of this subject:
OpenOffice Calc macro to add pie chart
That is, my data are:
And my code:
Sub Macro1
Dim oRange as Object
Dim oRangeAddress(1) As New com.sun.star.table.CellRangeAddress
Dim oRect As New com.sun.star.awt.Rectangle
Dim cTitle as String
oRange = thisComponent.getCurrentSelection.getRangeAddress
oSheets = ThisComponent.getSheets()
oSheet = oSheets.getByIndex(0)
oCharts = oSheet.Charts
oRect.Width = 10000
oRect.Height = 10000
oRect.X = 8000
oRect.Y = 1000
oRangeAddress(0).Sheet = oRange.Sheet
oRangeAddress(0).StartColumn = 0
oRangeAddress(0).StartRow = 0
oRangeAddress(0).EndColumn = 1
oRangeAddress(0).EndRow = 2
cTitle = "Test Results"
oCharts.addNewByName(cTitle,oRect,oRangeAddress(),TRUE, TRUE)
oChart = oCharts.getByName(cTitle).embeddedObject
oChart.Diagram = oChart.createInstance("com.sun.star.chart.PieDiagram")
oChart.HasMainTitle = True
oChart.Title.String = cTitle
End Sub
How can I get some green in my chart, instead of blue, for example?
Thank you for your help.
Here is one solution.
Sub Macro1
...
oFirstDiagram = oChart.getFirstDiagram()
oColorScheme = CreateUnoListener("XColorScheme_", "com.sun.star.chart2.XColorScheme")
oFirstDiagram.setDefaultColorScheme(oColorScheme)
End Sub
Function XColorScheme_getColorByIndex(index As Integer) As Long
Dim result As Long
result = &H0000FF ' blue
If index = 0 Then
result = &H00FF00 ' green
ElseIf index = 1 Then
result = &HFFFF00 ' yellow
End If
XColorScheme_getColorByIndex = result
End Function
The only relevant documentation I could find for this approach is the API docs: https://www.openoffice.org/api/docs/common/ref/com/sun/star/chart2/XDiagram.html.
Another way is to put the colors in column C.
Status Count Color
Unfinished 20 =COLOR(0,255,0)
Finished 30 =COLOR(255,0,0)
Then set the Range for Fill Color to use column C. If you want to see code for this second approach, post a comment and I'll look into it.
Yet another way is from https://forum.openoffice.org/en/forum/viewtopic.php?t=36001.
oChart.Diagram.DataRowSource = com.sun.star.chart.ChartDataRowSource.COLUMNS
oChart.FirstDiagram.CoordinateSystems(0).ChartTypes(0).DataSeries(0).Color = &H00FF00
However, this last approach did not change the color when I tried it.

How do i stop clipping of limit line text in ios-charts?

I have a requirement for drawing the limit line which is near to the top of the chart and I want to keep limit line label on top right. Is there any way, it can not be truncated. Please see my output.
enter image description here
try limitline.labelPosition = ChartLimitLabelPositionRightBottom;
if you want keep labelPosition on top right,
you may can try set yourYAxis.spaceTop = x;
if x == 0, the maxValue will match the top of the chart,
if x == 1, the maxValue will match the centerY of the chart,
sorry, I can't express myself well, but, just try it.
hope it works.
The default renderer is little bit messed up. Subclass it (YAxisRenderer) and override method: renderLimitLines. Copy the content from original renderer and replace lines:
var clippingRect = viewPortHandler.contentRect
clippingRect.origin.y -= l.lineWidth / 2.0
clippingRect.size.height += l.lineWidth
with:
var clippingRect = viewPortHandler.contentRect
clippingRect.origin.y -= l.lineWidth / 2.0 + l.valueFont.lineHeight
clippingRect.size.height += l.lineWidth + l.valueFont.lineHeight
Now, as you have it prepared, you need to set your new axis renderer for
let yAxisRenderer = CenteredLimitLineYAxisRenderer(
viewPortHandler: chart.viewPortHandler,
yAxis: chart.leftAxis,
transformer: chart.getTransformer(forAxis: .left)
)
chart.leftYAxisRenderer = yAxisRenderer