private static bool IsOfShape(Shape shape, Drawing.ShapeTypeValues shapeType) { bool isOfShape = false; var textBody = shape.Descendants <TextBody>().FirstOrDefault(); if (textBody != null) { var bodyProps = textBody.Descendants <Drawing.BodyProperties>().FirstOrDefault(); if (bodyProps != null) { var bodyWrapp = bodyProps.Wrap; if (bodyWrapp != null) { var presetGeometry = shape.Descendants <DocumentFormat.OpenXml.Drawing.PresetGeometry>().FirstOrDefault(); if (presetGeometry != null && presetGeometry.Prefix != null) { var wrappShape = presetGeometry.Preset.Value; isOfShape = wrappShape == shapeType; } } } } return(isOfShape); }
private void SetAllNull() { this.Transform2D = new SLTransform2D(); this.HasTransform2D = false; this.vPresetGeometry = A.ShapeTypeValues.Rectangle; this.HasGeometry = false; this.Fill = new SLFill(this.listThemeColors); this.Outline = new SLLinePropertiesType(this.listThemeColors); this.EffectList = new SLEffectList(this.listThemeColors); this.Rotation3D = new SLRotation3D(); this.Format3D = new SLFormat3D(this.listThemeColors); }
private void SetAllNull() { this.vBlackWhiteMode = A.BlackWhiteModeValues.Auto; this.HasBlackWhiteMode = false; this.Transform2D = new SLTransform2D(); this.HasTransform2D = false; this.vPresetGeometry = A.ShapeTypeValues.Rectangle; this.HasPresetGeometry = false; this.Fill = new SLFill(this.listThemeColors); this.Outline = new SLLinePropertiesType(this.listThemeColors); this.EffectList = new SLEffectList(this.listThemeColors); this.Rotation3D = new SLRotation3D(); this.Format3D = new SLFormat3D(this.listThemeColors); }
private void SetAllNull() { vBlackWhiteMode = A.BlackWhiteModeValues.Auto; HasBlackWhiteMode = false; Transform2D = new SLTransform2D(); HasTransform2D = false; vPresetGeometry = A.ShapeTypeValues.Rectangle; HasPresetGeometry = false; Fill = new SLFill(listThemeColors); Outline = new SLLinePropertiesType(listThemeColors); EffectList = new SLEffectList(listThemeColors); Rotation3D = new SLRotation3D(); Format3D = new SLFormat3D(listThemeColors); }
public static xdr.ShapeProperties Init(this xdr.ShapeProperties shapeProperties, a.ShapeTypeValues shapeType) { if (shapeProperties == null) { return(null); } var presetGeometry = new a.PresetGeometry() { Preset = shapeType }; //ShapeType - def shapeProperties.Append(presetGeometry); presetGeometry.Append(new a.AdjustValueList()); //shapeProperties.SetSolidFill(sysDr.Color.White); //var outline = new a.Outline().InitDefault(); // Outline - def //shapeProperties.Append(outline); return(shapeProperties); }
private void DrawShape(Wpg.WordprocessingGroup wordprocessingGroup, Rect cmlExtents, A.ShapeTypeValues shape, string colour) { UInt32Value id = UInt32Value.FromUInt32((uint)m_ooxmlId++); string bondLineName = "shape" + id; Int64Value width = OoXmlHelper.ScaleCmlToEmu(cmlExtents.Width); Int64Value height = OoXmlHelper.ScaleCmlToEmu(cmlExtents.Height); Int64Value top = OoXmlHelper.ScaleCmlToEmu(cmlExtents.Top); Int64Value left = OoXmlHelper.ScaleCmlToEmu(cmlExtents.Left); Point location = new Point(left, top); Size size = new Size(width, height); location.Offset(OoXmlHelper.ScaleCmlToEmu(-m_canvasExtents.Left), OoXmlHelper.ScaleCmlToEmu(-m_canvasExtents.Top)); Rect boundingBox = new Rect(location, size); width = (Int64Value)boundingBox.Width; height = (Int64Value)boundingBox.Height; top = (Int64Value)boundingBox.Top; left = (Int64Value)boundingBox.Left; A.PresetGeometry presetGeometry = null; A.Extents extents = new A.Extents { Cx = width, Cy = height }; presetGeometry = new A.PresetGeometry() { Preset = shape }; Wps.WordprocessingShape wordprocessingShape = new Wps.WordprocessingShape(); Wps.NonVisualDrawingProperties nonVisualDrawingProperties = new Wps.NonVisualDrawingProperties() { Id = id, Name = bondLineName }; Wps.NonVisualDrawingShapeProperties nonVisualDrawingShapeProperties = new Wps.NonVisualDrawingShapeProperties(); Wps.ShapeProperties shapeProperties = new Wps.ShapeProperties(); A.Transform2D transform2D = new A.Transform2D(); A.Offset offset = new A.Offset { X = left, Y = top }; transform2D.Append(offset); transform2D.Append(extents); A.AdjustValueList adjustValueList = new A.AdjustValueList(); presetGeometry.Append(adjustValueList); A.SolidFill solidFill = new A.SolidFill(); A.RgbColorModelHex rgbColorModelHex = new A.RgbColorModelHex { Val = colour }; solidFill.Append(rgbColorModelHex); shapeProperties.Append(transform2D); shapeProperties.Append(presetGeometry); shapeProperties.Append(solidFill); OoXmlHelper.AppendShapeStyle(wordprocessingShape, nonVisualDrawingProperties, nonVisualDrawingShapeProperties, shapeProperties); wordprocessingGroup.Append(wordprocessingShape); }
private void DrawShape(Wpg.WordprocessingGroup wordprocessingGroup1, Rect extents, A.ShapeTypeValues shape, string colour) { UInt32Value bondLineId = UInt32Value.FromUInt32((uint)_ooxmlId++); string bondLineName = "shape" + bondLineId; Int64Value width1 = OoXmlHelper.ScaleCmlToEmu(extents.Width); Int64Value height1 = OoXmlHelper.ScaleCmlToEmu(extents.Height); Int64Value top1 = OoXmlHelper.ScaleCmlToEmu(extents.Top); Int64Value left1 = OoXmlHelper.ScaleCmlToEmu(extents.Left); Point pp1 = new Point(left1, top1); Size ss2 = new Size(width1, height1); pp1.Offset(OoXmlHelper.ScaleCmlToEmu(-_canvasExtents.Left), OoXmlHelper.ScaleCmlToEmu(-_canvasExtents.Top)); Rect boundingBox = new Rect(pp1, ss2); Int64Value width = (Int64Value)boundingBox.Width; Int64Value height = (Int64Value)boundingBox.Height; Int64Value top = (Int64Value)boundingBox.Top; Int64Value left = (Int64Value)boundingBox.Left; A.Extents extents2 = null; A.PresetGeometry presetGeometry1 = null; extents2 = new A.Extents() { Cx = width, Cy = height }; presetGeometry1 = new A.PresetGeometry() { Preset = shape }; Wps.WordprocessingShape wordprocessingShape1 = new Wps.WordprocessingShape(); Wps.NonVisualDrawingProperties nonVisualDrawingProperties1 = new Wps.NonVisualDrawingProperties() { Id = bondLineId, Name = bondLineName }; Wps.NonVisualDrawingShapeProperties nonVisualDrawingShapeProperties1 = new Wps.NonVisualDrawingShapeProperties(); Wps.ShapeProperties shapeProperties1 = new Wps.ShapeProperties(); A.Transform2D transform2D1 = new A.Transform2D(); A.Offset offset2 = new A.Offset() { X = left, Y = top }; transform2D1.Append(offset2); transform2D1.Append(extents2); A.AdjustValueList adjustValueList1 = new A.AdjustValueList(); presetGeometry1.Append(adjustValueList1); A.SolidFill solidFill1 = new A.SolidFill(); A.RgbColorModelHex rgbColorModelHex1 = new A.RgbColorModelHex() { Val = colour }; A.Alpha alpha1 = new A.Alpha() { Val = new Int32Value() { InnerText = "100%" } }; solidFill1.Append(rgbColorModelHex1); shapeProperties1.Append(transform2D1); shapeProperties1.Append(presetGeometry1); shapeProperties1.Append(solidFill1); Wps.ShapeStyle shapeStyle1 = new Wps.ShapeStyle(); A.LineReference lineReference1 = new A.LineReference() { Index = (UInt32Value)0U }; A.FillReference fillReference1 = new A.FillReference() { Index = (UInt32Value)0U }; A.EffectReference effectReference1 = new A.EffectReference() { Index = (UInt32Value)0U }; A.FontReference fontReference1 = new A.FontReference() { Index = A.FontCollectionIndexValues.Minor }; shapeStyle1.Append(lineReference1); shapeStyle1.Append(fillReference1); shapeStyle1.Append(effectReference1); shapeStyle1.Append(fontReference1); Wps.TextBodyProperties textBodyProperties1 = new Wps.TextBodyProperties(); wordprocessingShape1.Append(nonVisualDrawingProperties1); wordprocessingShape1.Append(nonVisualDrawingShapeProperties1); wordprocessingShape1.Append(shapeProperties1); wordprocessingShape1.Append(shapeStyle1); wordprocessingShape1.Append(textBodyProperties1); wordprocessingGroup1.Append(wordprocessingShape1); }
public static xdr.Shape AddShape(this x.Worksheet ws, a.ShapeTypeValues shapeType, string name = null) { var worksheetDrawing = ws.GetWorksheetDrawing(); return(worksheetDrawing.AddShape(shapeType, name));; }
private void InitialisePicture() { // should be true once we get *everyone* to stop using those confoundedly // hard to understand EMUs and absolute positionings... UseEasyPositioning = false; TopPosition = 0; LeftPosition = 0; UseRelativePositioning = true; AnchorRowIndex = 1; AnchorColumnIndex = 1; OffsetX = 0; OffsetY = 0; WidthInEMU = 0; HeightInEMU = 0; WidthInPixels = 0; HeightInPixels = 0; fHorizontalResolutionRatio = 1; fVerticalResolutionRatio = 1; this.bLockWithSheet = true; this.bPrintWithSheet = true; this.vCompressionState = A.BlipCompressionValues.Print; this.decBrightness = 0; this.decContrast = 0; //this.decRotationAngle = 0; this.vPictureShape = A.ShapeTypeValues.Rectangle; this.FillType = SLPictureFillType.None; this.FillClassInnerXml = string.Empty; this.HasOutline = false; this.PictureOutline = new A.Outline(); this.HasOutlineFill = false; this.PictureOutlineFill = new A.SolidFill(); this.HasGlow = false; this.GlowRadius = 0; this.GlowColorInnerXml = string.Empty; this.HasInnerShadow = false; this.PictureInnerShadow = new A.InnerShadow(); this.HasOuterShadow = false; this.PictureOuterShadow = new A.OuterShadow(); this.HasReflection = false; this.ReflectionBlurRadius = 0; this.ReflectionStartOpacity = 100000; this.ReflectionStartPosition = 0; this.ReflectionEndAlpha = 0; this.ReflectionEndPosition = 100000; this.ReflectionDistance = 0; this.ReflectionDirection = 0; this.ReflectionFadeDirection = 5400000; this.ReflectionHorizontalRatio = 100000; this.ReflectionVerticalRatio = 100000; this.ReflectionHorizontalSkew = 0; this.ReflectionVerticalSkew = 0; this.ReflectionAlignment = A.RectangleAlignmentValues.Bottom; this.ReflectionRotateWithShape = true; this.HasSoftEdge = false; this.SoftEdgeRadius = 0; this.HasScene3D = false; this.CameraLatitude = 0; this.CameraLongitude = 0; this.CameraRevolution = 0; this.CameraPreset = A.PresetCameraValues.OrthographicFront; this.CameraFieldOfView = 0; this.CameraZoom = 0; this.LightRigLatitude = 0; this.LightRigLongitude = 0; this.LightRigRevolution = 0; this.LightRigType = A.LightRigValues.ThreePoints; this.LightRigDirection = A.LightRigDirectionValues.Top; //this.HasBackdrop = false; //this.BackdropAnchorX = 0; //this.BackdropAnchorY = 0; //this.BackdropAnchorZ = 0; //this.BackdropNormalDx = 0; //this.BackdropNormalDy = 0; //this.BackdropNormalDz = 0; //this.BackdropUpVectorDx = 0; //this.BackdropUpVectorDy = 0; //this.BackdropUpVectorDz = 0; this.HasBevelTop = false; this.BevelTopPreset = A.BevelPresetValues.Circle; this.BevelTopWidth = 76200; this.BevelTopHeight = 76200; this.HasBevelBottom = false; this.BevelBottomPreset = A.BevelPresetValues.Circle; this.BevelBottomWidth = 76200; this.BevelBottomHeight = 76200; this.HasExtrusion = false; this.ExtrusionHeight = 0; this.ExtrusionColorInnerXml = string.Empty; this.HasContour = false; this.ContourWidth = 0; this.ContourColorInnerXml = string.Empty; this.HasMaterialType = false; this.MaterialType = A.PresetMaterialTypeValues.WarmMatte; this.HasZDistance = false; this.ZDistance = 0; this.HasUri = false; this.HyperlinkUri = string.Empty; this.HyperlinkUriKind = UriKind.Absolute; this.IsHyperlinkExternal = true; this.DataIsInFile = true; this.PictureFileName = string.Empty; this.PictureByteData = new byte[1]; this.PictureImagePartType = ImagePartType.Bmp; }