The code is as below (CATScript):
Sub CATMain()
' enter sheet background
Set oView = oDrawingDocument.DrawingRoot.ActiveSheet.Views.Item("Background View")
oView.Activate
' select all views in current screen
Set oSelection = oDrawingDocument.Selection
oSelection.Search "Type=*,scr"
' set visual to black
oSelection.VisProperties.SetRealColor 0, 0, 0, 0
' exit sheet background
Set oView = oDrawingDocument.DrawingRoot.ActiveSheet.Views.Item("Main View")
oView.Activate
End Sub
The code works seamlessly except that oSelection.VisProperties.SetRealColor 255, 255, 255, 0 does not change any of the selected lines and frames to black in my 2D drawing. Manually I can do this so pretty sure I'm just using the wrong syntax. SetVisibleColor neither works, but then also I can only find that these syntaxes are used for changing color in 3D and I am using it for a 2D drawing. Anyone here knows the syntax to manipulate the color icon in the 'Graphic Properties' workspace for a 2D drawing?
This is the solution I found after some research and trial&error:
'CHANGE LINE COLOR
Set oSelectionGI = oDrawingDocument.Selection
oSelectionGI.Search("CATDrwSearch.CATEarlyGenItem,all")
oSelectionGI.VisProperties.SetRealColor 0,0,0,0
'CHANGE TEXT COLOR
Set oSelectionDC = oDrawingDocument.Selection
oSelectionDC.Search("CATDrwSearch.DrwText,all")
oSelectionDC.VisProperties.SetRealColor 0,0,0,0
'CHANGE TABLE COLOR
Set oSelectionDT = oDrawingDocument.Selection
oSelectionDT.Search("CATDrwSearch.DrwTable,all")
oSelectionDT.VisProperties.SetRealColor 0,0,0,0
Related
I'm creating an XlChartType.xl3DColumnStacked chart and now I want to explicitly set the color of each series. Everything I've tried so far has failed. Does somebody have an example they can show me please?
You just have to loop on the Chart.SeriesCollection and set series.Interior.Color to the desired RGB integer value.
For i = 1 To chart.SeriesCollection.count
Dim series As Series = chart.SeriesCollection(i)
series.Interior.Color = newColor
Next
Is there a way to add a border around every image in Word? I know that I can create a custom paragraph style with a border and put the image in there, but maybe I can just specify a global image style, like in CSS:
img { border: 1px solid #000 }
Unfortunately, there is no picture style concept available in Word. Therefore, something like specifying a global style for images similar to CSS is not possible.
What you can do is write a VBA macro that adds the border to all images. The code is a little different depending on whether your image is formatted to be inline with text (InlineShape) or floating (Shape):
Sub AddBorderToPictures()
' Add border to pictures that are "inline with text"
Dim oInlineShape As inlineShape
For Each oInlineShape In ActiveDocument.InlineShapes
oInlineShape.Borders.Enable = True
oInlineShape.Borders.OutsideColor = wdColorBlack
oInlineShape.Borders.OutsideLineWidth = wdLineWidth100pt
oInlineShape.Borders.OutsideLineStyle = wdLineStyleSingle
Next
' Add border to pictures that are floating
Dim oShape As shape
For Each oShape In ActiveDocument.Shapes
oShape.Line.ForeColor.RGB = RGB(0, 0, 0)
oShape.Line.Weight = 1
oShape.Line.DashStyle = msoLineSolid
Next
End Sub
If apparently setting the line width to wdLineWidth100pt is an issue, you can try using the actual underlying integer value instead, e.g.:
oInlineShape.Borders.OutsideLineWidth = 8
This is how the constant is defined:
public enum WdLineWidth
{
wdLineWidth025pt = 2,
wdLineWidth050pt = 4,
wdLineWidth075pt = 6,
wdLineWidth100pt = 8,
wdLineWidth150pt = 12,
wdLineWidth225pt = 18,
wdLineWidth300pt = 24,
wdLineWidth450pt = 36,
wdLineWidth600pt = 48,
}
Is there a way to set no border when drawing background-color filled rectangle? Or make border color match background-color filled rectange?
PrimitiveComposer primitiveComposer = new PrimitiveComposer(page);
{
BlockComposer blockComposer = new BlockComposer(primitiveComposer);
primitiveComposer.SetLineWidth(0.0f);
primitiveComposer.SetFillColor(DeviceRGBColor.Get(System.Drawing.Color.DarkGray));
primitiveComposer.DrawRectangle(new RectangleF(_boxMarginX, _boxMarginY, (page.Size.Width - (_boxMarginX * 2)), 205f), 0f);
primitiveComposer.FillStroke();
}
You use
primitiveComposer.FillStroke();
which is the command to fill and stroke a path. As you don't want the borders, i.e. you don't want to stroke, use
primitiveComposer.Fill();
instead.
By the way,
primitiveComposer.SetLineWidth(0.0f);
The PDF specification defines a line width of 0 to mean the smallest line the target device can render.
I generated some fonts in Hiero. If I set the font color with :
fontFPS.setColor(Color.YELLOW);
the text color it is drawn correctly.
But if I set it with
Color fpsColor = new Color(74f, 112f, 139f, 160f);
fontFPS.setColor(fpsColor);
then I only get white color with no alpha. What is the problem?
First of all float values inside that method should be from 0f to 1f. So your color should be (values I put in constructor are calculated by dividing your original values with 255)
Color fpsColor = new Color(0.29f, 0.43f, 0.54f, 0.66f);
Also you should enable blending like this (I'm not sure if you already did that)
Gdx.gl.glEnable(GL10.GL_BLEND);
Gdx.gl.glBlendFunc(GL10.GL_SRC_ALPHA, GL10.GL_ONE_MINUS_SRC_ALPHA)
I have lots of files to generate a plot for and therefore wrote a little script for gnuplot.
I want to add additional information with a label underneath the graph but my label is not displayed on the generated image.
Anyone gut an idea?
load.plt:
# template.gnuplot
set terminal png
filename = "results-05112012-".i.".dat"
plotfile = "results-05112012-".i.".png"
print filename." ".plotfile
set grid
set title "EER""
set output plotfile
set label "m = 20" at 0, 3 front tc rgb "#ffffff"
plot[0.35:0.75][0:100] filename using 1:6 title "FAR" w lp, filename using 1:7 title "FRR" w lp
unset output
unset label
i=i+1
if(i <= n) reread
I can see two reasons why the label might not appear. One is that the label is at the point (0,3) which is not within the plot region [0.35:0.75][0:100]. The other is that the label is white in color (#ffffff).