Freeze Pane openxml Sdk - c#

So I am working to add the freeze pane in excel using openxml sdk and for that I am using the following code
SheetView sheetView1 = new() { TabSelected = true, WorkbookViewId = (UInt32Value)0U };
Pane pane1 = new()
{
HorizontalSplit = 1,
VerticalSplit = 1,
TopLeftCell = "B2",
ActivePane = PaneValues.TopRight,
State = PaneStateValues.Frozen
};
And this code works fine, but what I need to know is what the use of ActivePane present in 7th line as because if I remove that line it also works fine or if I change its value then it works the same.
And also there is one more piece of code added with the above code
Selection selection1 = new Selection()
{
Pane = PaneValues.TopRight,
ActiveCell = "B1",
SequenceOfReferences = new ListValue<StringValue>()
{
InnerText = "B1"
}
};
Selection selection2 = new Selection()
{
Pane = PaneValues.BottomLeft,
ActiveCell = "A3",
SequenceOfReferences = new ListValue<StringValue>()
{
InnerText = "A3"
}
};
Selection selection3 = new Selection()
{
Pane = PaneValues.BottomRight,
ActiveCell = "B3",
SequenceOfReferences = new ListValue<StringValue>()
{
InnerText = "B3"
}
};
And this code if I remove it also works fine.
So my question is can you tell me what is the use of ActivePane, the whole Selection Class and if I remove them from my code what it can raise the error in future.
Thanks.

Related

How can i disable series animation in highchart tree map?

I wrote the following code to disable the series animation :
Animation = new Animation{Enabled = false},
But after runing my application , the problem still persists.
My code to display the treemap is as follows:
#{ var chartOptions =
new Highcharts
{
Title = new Title
{
Text = ""
},
Credits = new Credits
{
Enabled = false
},
Series = new List<Series>
{
new TreemapSeries
{
Animation = new Animation{Enabled = false},
LayoutAlgorithm = TreemapSeriesLayoutAlgorithm.Squarified,
AlternateStartingDirection = true,
Levels = new List<TreemapSeriesLevels>
{
new TreemapSeriesLevels
{
Level = 1,
LayoutAlgorithm = TreemapSeriesLevelsLayoutAlgorithm.Squarified,
DataLabels = new TreemapSeriesDataLabels()
{
Enabled = true,
Align = TreemapSeriesDataLabelsAlign.Left,
VerticalAlign = TreemapSeriesDataLabelsVerticalAlign.Top
}
}
},
Data = #ViewBag.resultGreen
,
}
}
};
chartOptions.ID = "chart";
chartOptions.PlotOptions.Series.Animation.Enabled = false;
var renderer = new HighchartsRenderer(chartOptions);
}
#Html.Raw(renderer.RenderHtml())
How can i solve this problems?
I tried to solve this problem by the link below:
How to disable animations on Highcharts Dotnet C# MVC?
The provided answer in the mentioned thread looks to be related to DotNet.Highcharts. If you use the official Highcharts .NET wrapper use the AnimationBool option:
new TreemapSeries
{
AnimationBool = false,
...
}
API Reference:
https://dotnet.highcharts.com/Help/Highcharts/html/class_highsoft_1_1_web_1_1_mvc_1_1_charts_1_1_treemap_series.html#a3b53a65560c6917e7ee52e1779335b2e

NoTextEdit ShapeLock is not working - OpenXML SDK

I am trying to make a TextBox locked by using OpenXML SDK. I've tried this method but the TextBox NoTextEdit is not working.
public DocumentFormat.OpenXml.Presentation.Shape GenerateShape(string StrText)
{
DocumentFormat.OpenXml.Presentation.Shape shape1 = new DocumentFormat.OpenXml.Presentation.Shape();
DocumentFormat.OpenXml.Presentation.NonVisualShapeProperties nonVisualShapeProperties1 = new DocumentFormat.OpenXml.Presentation.NonVisualShapeProperties();
DocumentFormat.OpenXml.Presentation.NonVisualDrawingProperties nonVisualDrawingProperties1 = new DocumentFormat.OpenXml.Presentation.NonVisualDrawingProperties() { Id = (UInt32Value)3U, Name = "ID",Hidden=true ,Description="Do not Remove" ,MCAttributes=null };
DocumentFormat.OpenXml.Presentation.NonVisualShapeDrawingProperties nonVisualShapeDrawingProperties1 = new DocumentFormat.OpenXml.Presentation.NonVisualShapeDrawingProperties();
Drawing.ShapeLocks shapeLocks1 = new Drawing.ShapeLocks() { NoTextEdit = true, NoGrouping = true,NoMove=true,NoSelection=true,NoEditPoints=true ,NoAdjustHandles=true ,NoRotation=true,NoChangeArrowheads=true,NoChangeAspect=true,NoChangeShapeType=true,NoResize=true};
nonVisualShapeDrawingProperties1.Append(shapeLocks1);
ApplicationNonVisualDrawingProperties applicationNonVisualDrawingProperties1 = new ApplicationNonVisualDrawingProperties();
PlaceholderShape placeholderShape1 = new PlaceholderShape() { Type = PlaceholderValues.SubTitle, Index = (UInt32Value)1U };
applicationNonVisualDrawingProperties1.Append(placeholderShape1);
nonVisualShapeProperties1.Append(nonVisualDrawingProperties1);
nonVisualShapeProperties1.Append(nonVisualShapeDrawingProperties1);
nonVisualShapeProperties1.Append(applicationNonVisualDrawingProperties1);
DocumentFormat.OpenXml.Presentation.ShapeProperties shapeProperties1 = new DocumentFormat.OpenXml.Presentation.ShapeProperties();
DocumentFormat.OpenXml.Presentation.TextBody textBody1 = new DocumentFormat.OpenXml.Presentation.TextBody();
Drawing.BodyProperties bodyProperties1 = new Drawing.BodyProperties();
Drawing.ListStyle listStyle1 = new Drawing.ListStyle();
Drawing.TextShape shp = new Drawing.TextShape();
Drawing.Paragraph paragraph1 = new Drawing.Paragraph();
Drawing.EndParagraphRunProperties endParagraphRunProperties1 = new Drawing.EndParagraphRunProperties() { Language = "en-US" ,Dirty=false };
paragraph1.Append(GenerateRun(StrText));
paragraph1.Append(endParagraphRunProperties1);
textBody1.Append(bodyProperties1);
textBody1.Append(listStyle1);
textBody1.Append(paragraph1);
shape1.Append(nonVisualShapeProperties1);
shape1.Append(shapeProperties1);
shape1.Append(textBody1);
return shape1;
}
public Drawing.Run GenerateRun(string StrText)
{
Drawing.Run run1 = new Drawing.Run();
Drawing.RunProperties runProperties1 = new Drawing.RunProperties() { Language = "en-US", Dirty = false };
runProperties1.SetAttribute(new OpenXmlAttribute("", "smtClean", "", "0"));
Drawing.Text text1 = new Drawing.Text();
text1.Text = StrText;
Drawing.SolidFill solidFill2 = new Drawing.SolidFill();
Drawing.SchemeColor schemeColor = new Drawing.SchemeColor();
string y = System.Drawing.Color.Transparent.ToArgb().ToString("X");
Drawing.RgbColorModelHex rgbColorModelHex2 = new Drawing.RgbColorModelHex() { Val = "FFFFFF" };//Set Font-Color to Blue (Hex "0070C0").
solidFill2.Append(rgbColorModelHex2);
runProperties1.Append(solidFill2);
Color color = new Color() { Val = "365F91", ThemeColor = ThemeColorValues.Accent1, ThemeShade = "BF" };
run1.Append(runProperties1);
run1.Append(text1);
return run1;
}
Everything works fine except editing. Still the user can edit the TextBox values by double clicking it. How can I avoid this ?
Is there any permanent solution to prevent editing ? Please help me to find a better solution.
Thanks in advance
By researching and communications with the MVP team I've pointed out that there is no way to Protect the TextBox from editing.
As Cindy Meister mentioned in the comments,
Are you able to do it in the PowerPoint application user interface? If not, then Open XML cannot do it... If yes, you can.
If you do not want to text to be changed , Just change it as image then lock that by using NoSelection=true/1 and NoMove=true/1 properties. If you enable these properties the user can't either delete nor change it's position.
For your ref: https://answers.microsoft.com/en-us/msoffice/forum/msoffice_powerpoint-mso_windows8-mso_2016/shape-lock-is-not-working/c1705b55-d2aa-4adb-b538-574ed2fc8eca?tm=1579265435636&page=1&rtAction=1579495439869

Exporting OxyPlot chart to png in asp.net phoject

I'm using asp.net for generating pdf file. In pdf i must show plot. I decided using oxyplot with exporting it in png and inserting in pdf. The documentation says using PlotModel, filling it with series and axes and simply export by using PngExporting object. But when I'm trying generate it, nothing is presented except the axes.
The code I'm using:
var _plotModel = new OxyPlot.PlotModel()
{
PlotAreaBorderColor = OxyPlot.OxyColors.Transparent,
LegendBorder = OxyPlot.OxyColors.Transparent,
TitleToolTip = "Temperature",
Culture = new System.Globalization.CultureInfo("ru-Ru"),
Series =
{
new OxyPlot.Series.LineSeries()
{
ItemsSource = new List<SimplePointModel>
{
new SimplePointModel { Date = DateTime.Now, Temperature = 36.6f },
new SimplePointModel { Date = DateTime.Now.AddDays(1), Temperature = 42.6f },
new SimplePointModel { Date = DateTime.Now.AddDays(2), Temperature = 48.6f },
},
MarkerFill = OxyPlot.OxyColor.Parse("#A9CF9C"),
MarkerType = OxyPlot.MarkerType.Circle,
MarkerSize = item.ListSegments[0].Count() == 1 ? 2 : 1,
DataFieldX = "Date",
DataFieldY = "Temperature",
XAxisKey = "Date",
YAxisKey = "Temperature",
Color = OxyPlot.OxyColor.Parse("#A9CF9C"),
}
},
Axes =
{
new OxyPlot.Axes.DateTimeAxis()
{
Position = OxyPlot.Axes.AxisPosition.Bottom,
Key = "Date",
ToolTip = "Temperature",
AbsoluteMinimum = OxyPlot.Axes.Axis.ToDouble(DateTime.Now.Date),
AbsoluteMaximum = OxyPlot.Axes.Axis.ToDouble(DateTime.Now.AddDays(10000))
},
new OxyPlot.Axes.LinearAxis()
{
Position = OxyPlot.Axes.AxisPosition.Left,
Key = "Temperature",
ToolTip = "Temperature",
IsZoomEnabled = false,
IsPanEnabled = false,
}
}
};
using (var stream = System.IO.File.Create(Path.Combine(folder, "temp.png")))
{
PngExporter.Export(_plotModel, stream, 800, 400, OxyPlot.OxyColors.Transparent);
}
What can I do?
I found solution: we must load data to Points list parameter in Series object instead of ItemSource parameter. ItemSource parameter used in mobile version of library.

Adding picture and comment to cell causes issue

I am using the following code to add a comment :
ws.Cell("A5").Comment.SetVisible().AddText("sample");
ws.PageSetup.SetShowComments(XLShowCommentsValues.AsDisplayed);
When I comment out the following code, which adds an image to the excel document, then the comment works. But with this code uncommented, the below error occurs:
XLPicture pic = new XLPicture
{
NoChangeAspect = true,
NoMove = true,
NoResize = true,
ImageStream = memo,
Name = "Export Image",
PaddingX = 12,
PaddingY = 18
};
XLMarker fMark = new XLMarker { ColumnId = 1, RowId = 1 };
pic.AddMarker(fMark);
workSheet.AddPicture(pic);
Error is :

How to implement Signer Attachment in Docusign?

The requirement which I have regarding docusign is I need to implement Signer Attachment and that same scenario is mentioned at [https://github.com/docusign/docusign-soap-sdk/wiki/Code-Walkthrough-_-Signer-Attachments]
But I am not sure how do I achieve with code in C#. As not sure how do I attach it to Envelope?
I want to send someone a contract letter to sign and also request them attach few docs and when all of that is completed , those docs should be sent to my email.
Anyone knows if I can achieve it with docusign?
The previous entry is not bad... I got it working eventually. But this code below is solid, in production, and works great! It also uses anchor strings.
EnvelopeDefinition env = new EnvelopeDefinition();
env.EmailSubject = "Please sign this document set";
Document doc4 = new Document
{
DocumentBase64 = doc4PdfBytes,
Name = "Voided Check Attachment", // can be different from actual file name
FileExtension = "pdf",
DocumentId = "4"
};
env.Documents = new List<Document> { doc4 };
SignerAttachment signAttachDoc = new SignerAttachment
{
TabLabel = "Attach your voided check",
DocumentId = "1",
TabId = "1",
PageNumber = "1",
AnchorString = "/at1/",
AnchorUnits = "pixels",
AnchorXOffset = "0",
AnchorYOffset = "0",
AnchorIgnoreIfNotPresent = "false",
};
Tabs signer1Tabs = new Tabs
{
SignerAttachmentTabs = new List<SignerAttachment> { signAttachDoc }
};
signer1.Tabs = signer1Tabs;
Recipients recipients1 = new Recipients
{
Signers = new List<Signer> { signer1 }
};
env.Recipients = recipients1;
Here is how we can do it while using C# SDK
create a signer object
Signer signer = new Signer();
signer.Name = recipientName;
signer.Email = recipientEmail;
signer.RecipientId = "1";
then create attachment tabs
signer.Tabs.SignerAttachmentTabs = new List<SignerAttachment>();
after which we need an attachment to add to it
SignerAttachment signDoc = new SignerAttachment();
signDoc.TabLabel = "Attach your Other Doc";
signDoc.DocumentId = "1";
signDoc.TabId = "1";
signDoc.PageNumber = "1";
And finally we add it to the tabs
signer.Tabs.SignerAttachmentTabs.Add(signDoc);

Categories