Add Hyperlink to Cell in Excel 2007 Using Open XML SDK 2.0 - openxml

I can't seem to find any documentation or code samples on how to add a hyperlink to a cell in Excel 2007 using the Open XML SDK 2.0. I am using the following code, but is there a step I am missing?
WorksheetPart workSheetPart = ExcelUtilities.GetWorkSheetPart(mWorkBookPart, "Program");
workSheetPart.AddHyperlinkRelationship(new Uri("http://www.google.com", UriKind.Absolute), true);
workSheetPart.Worksheet.Save();
mWorkBookPart.Workbook.Save();
Then when I try and open the Excel document it says the file is corrupted because the Relationship Id for the hyperlink cannot be found. How do you setup or create that Relationship Id?

Another possibility, (which I used), is to use the HYPERLINK formula for Excel. I needed to create individual hyperlinks in each cell, yet the cells had to display different text, (I had to display tracking numbers in the cells yet have a hyperlink for each tracking number to the carrier's site and had to handle multiple carriers).
Once I instantiated an individual cell, the formula was applied in this manner to each cell (there are undoubtedly numerous way):
// ...
Cell cell1 = new Cell(){ CellReference = "A1", StyleIndex = (UInt32Value)1U, DataType = CellValues.InlineString };
CellValue cellValue1 = new CellValue();
CellFormula cellFormula1 = new CellFormula() { Space = SpaceProcessingModeValues.Preserve };
cellFormula1.Text = #"HYPERLINK(""http://www.theclash.com"", ""Radio Clash"")";
cellValue1.Text = "Radio Clash";
cell1.Append(cellFormula1);
cell1.Append(cellValue1);
// append cell, etc.
In this way, I was able to create individual hyperlinks and text for each cell. By the way, the links will appear with the default font color unless you reference a style with blue font.
Hope this helps.

I was able to add a hyperlink to a cell using System.IO.Packaging code:
private void HyperlinkCreate(PackagePart part, XmlNamespaceManager nsm, XmlNode _cellElement, string CellAddress)
{
Uri _hyperlink = new Uri("http://www.yahoo.com");
XmlNode linkParent = _cellElement.OwnerDocument.SelectSingleNode("//d:hyperlinks", nsm);
if (linkParent == null)
{
// create the hyperlinks node
linkParent = _cellElement.OwnerDocument.CreateElement("hyperlinks", #"http://schemas.openxmlformats.org/spreadsheetml/2006/main");
XmlNode prevNode = _cellElement.OwnerDocument.SelectSingleNode("//d:conditionalFormatting", nsm);
if (prevNode == null)
{
prevNode = _cellElement.OwnerDocument.SelectSingleNode("//d:mergeCells", nsm);
if (prevNode == null)
{
prevNode = _cellElement.OwnerDocument.SelectSingleNode("//d:sheetData", nsm);
}
}
_cellElement.OwnerDocument.DocumentElement.InsertAfter(linkParent, prevNode);
}
string searchString = string.Format("./d:hyperlink[#ref = '{0}']", CellAddress);
XmlElement linkNode = (XmlElement)linkParent.SelectSingleNode(searchString, nsm);
XmlAttribute attr;
if (linkNode == null)
{
linkNode = _cellElement.OwnerDocument.CreateElement("hyperlink", #"http://schemas.openxmlformats.org/spreadsheetml/2006/main");
// now add cell address attribute
linkNode.SetAttribute("ref", CellAddress);
linkParent.AppendChild(linkNode);
}
attr = (XmlAttribute)linkNode.Attributes.GetNamedItem("id", #"http://schemas.openxmlformats.org/officeDocument/2006/relationships");
if (attr == null)
{
attr = _cellElement.OwnerDocument.CreateAttribute("r", "id", #"http://schemas.openxmlformats.org/officeDocument/2006/relationships");
linkNode.Attributes.Append(attr);
}
PackageRelationship relationship = null;
string relID = attr.Value;
if (relID == "")
relationship = part.CreateRelationship(_hyperlink, TargetMode.External, #"http://schemas.openxmlformats.org/officeDocument/2006/relationships/hyperlink");
else
{
relationship = part.GetRelationship(relID);
if (relationship.TargetUri != _hyperlink)
relationship = part.CreateRelationship(_hyperlink, TargetMode.External, #"http://schemas.openxmlformats.org/officeDocument/2006/relationships/hyperlink");
}
attr.Value = relationship.Id;
}
I then translated this code using the Open XML SDK 2.0 and it doesn't work. It seems the AddHyperlinkRelationship method doesn't actually add the relationship to the .rels file. I'm not sure why, but it sure seems like a bug to me.
private void HyperlinkCreate(PackagePart part, XmlNamespaceManager nsm, XmlNode _cellElement, string CellAddress)
{
WorksheetPart workSheetPart = ExcelUtilities.GetWorkSheetPart(mWorkBookPart, "Program");
Uri hyperlinkUri = new Uri("http://www.yahoo.com", UriKind.Absolute);
Hyperlinks hyperlinks = workSheetPart.Worksheet.Descendants<Hyperlinks>().FirstOrDefault();
// Check to see if the <x:hyperlinks> element exists; if not figure out
// where to insert it depending on which elements are present in the Worksheet
if (hyperlinks == null)
{
// Create the hyperlinks node
hyperlinks = new Hyperlinks();
OpenXmlCompositeElement prevElement = workSheetPart.Worksheet.Descendants<ConditionalFormatting>().FirstOrDefault();
if (prevElement == null)
{
prevElement = workSheetPart.Worksheet.Descendants<MergeCells>().FirstOrDefault();
if (prevElement == null)
{
// No FirstOrDefault needed since a Worksheet requires SheetData or the excel doc will be corrupt
prevElement = workSheetPart.Worksheet.Descendants<SheetData>().First();
}
}
workSheetPart.Worksheet.InsertAfter(hyperlinks, prevElement);
}
Hyperlink hyperlink = hyperlinks.Descendants<Hyperlink>().Where(r => r.Reference.Equals(CellAddress)).FirstOrDefault();
if (hyperlink == null)
{
hyperlink = new Hyperlink() { Reference = CellAddress, Id = string.Empty };
}
HyperlinkRelationship hyperlinkRelationship = null;
string relId = hyperlink.Id;
if (relId.Equals(string.Empty))
{
hyperlinkRelationship = workSheetPart.AddHyperlinkRelationship(hyperlinkUri, true);
}
else
{
hyperlinkRelationship = workSheetPart.GetReferenceRelationship(relId) as HyperlinkRelationship;
if (!hyperlinkRelationship.Uri.Equals(hyperlinkUri))
{
hyperlinkRelationship = workSheetPart.AddHyperlinkRelationship(hyperlinkUri, true);
}
}
hyperlink.Id = hyperlinkRelationship.Id;
hyperlinks.AppendChild<Hyperlink>(hyperlink);
workSheetPart.Worksheet.Save();
}

You should be adding it to an object that accepts hyperlinks, such as a cell, instead of the worksheet. Something like this should work for you:
using DocumentFormat.OpenXml.Spreadsheet;
using DocumentFormat.OpenXml;
namespace GeneratedCode
{
public class GeneratedClass
{
// Creates an Worksheet instance and adds its children.
public Worksheet GenerateWorksheet()
{
Worksheet worksheet1 = new Worksheet(){ MCAttributes = new MarkupCompatibilityAttributes(){ Ignorable = "x14ac" } };
worksheet1.AddNamespaceDeclaration("r", "http://schemas.openxmlformats.org/officeDocument/2006/relationships");
worksheet1.AddNamespaceDeclaration("mc", "http://schemas.openxmlformats.org/markup-compatibility/2006");
worksheet1.AddNamespaceDeclaration("x14ac", "http://schemas.microsoft.com/office/spreadsheetml/2009/9/ac");
SheetDimension sheetDimension1 = new SheetDimension(){ Reference = "A1" };
SheetViews sheetViews1 = new SheetViews();
SheetView sheetView1 = new SheetView(){ TabSelected = true, WorkbookViewId = (UInt32Value)0U };
sheetViews1.Append(sheetView1);
SheetFormatProperties sheetFormatProperties1 = new SheetFormatProperties(){ DefaultRowHeight = 14.4D, DyDescent = 0.3D };
SheetData sheetData1 = new SheetData();
Row row1 = new Row(){ RowIndex = (UInt32Value)1U, Spans = new ListValue<StringValue>() { InnerText = "1:1" }, DyDescent = 0.3D };
Cell cell1 = new Cell(){ CellReference = "A1", StyleIndex = (UInt32Value)1U, DataType = CellValues.SharedString };
CellValue cellValue1 = new CellValue();
cellValue1.Text = "0";
cell1.Append(cellValue1);
row1.Append(cell1);
sheetData1.Append(row1);
Hyperlinks hyperlinks1 = new Hyperlinks();
Hyperlink hyperlink1 = new Hyperlink(){ Reference = "A1", Id = "rId1" };
hyperlinks1.Append(hyperlink1);
PageMargins pageMargins1 = new PageMargins(){ Left = 0.7D, Right = 0.7D, Top = 0.75D, Bottom = 0.75D, Header = 0.3D, Footer = 0.3D };
worksheet1.Append(sheetDimension1);
worksheet1.Append(sheetViews1);
worksheet1.Append(sheetFormatProperties1);
worksheet1.Append(sheetData1);
worksheet1.Append(hyperlinks1);
worksheet1.Append(pageMargins1);
return worksheet1;
}
}
}

Easiest way is to use the HyperLink formular, but the links aren't blue by default, this is why the styleIndex is set.
private Cell BuildHyperlinkCell(string url) =>
new Cell
{
DataType = new EnumValue<CellValues>(CellValues.String),
CellFormula = new CellFormula($"HyperLink(\"{url}\")"),
StyleIndex = 4u
};
Adding the styling to the workbook:
http://www.dispatchertimer.com/tutorial/how-to-create-an-excel-file-in-net-using-openxml-part-3-add-stylesheet-to-the-spreadsheet/

Related

How do I populate a LiteDB database if some of my values are null

I am populating a dataGridView from an incomplete excel spreadsheet and generating the LiteDB from the dataGridView. Before the recent update, I wasn't having any issues. Now I am getting the error 'Objects cannot be cast from DBNull to other types'. I can work around this by including dummy values in the original spreadsheet. But ultimately we need to see what information we're missing. How can I accomplish this?
public void CreateDatabase()
{
using (var db = new LiteDatabase(#"C:\Users\BThatcher\Documents\_Personal\Revit\MDL-Sheets\SheetDatabase04.db")) //< ----------------
{
var sheets = db.GetCollection<Sheet>("sheets");
foreach (DataGridViewRow row in dataGridView2.Rows)
{
var sheet = new Sheet
{
SheetSequence = Convert.ToInt32(row.Cells[0].Value),
SheetNumber = row.Cells[1].Value.ToString(),
SheetName = row.Cells[2].Value.ToString(),
AreaNumber = Convert.ToInt32(row.Cells[3].Value),
AreaName = row.Cells[4].Value.ToString(),
SheetDiscipline = row.Cells[5].Value.ToString(),
DisciplineSort = Convert.ToInt32(row.Cells[6].Value),
SheetSort = Convert.ToInt32(row.Cells[7].Value),
ModelName = row.Cells[8].Value.ToString(),
AppearsInSheetlist = row.Cells[9].Value.ToString(),
DesignedBy = row.Cells[10].Value.ToString(),
DrawnBy = row.Cells[11].Value.ToString(),
CheckedBy = row.Cells[12].Value.ToString(),
ApprovedBy = row.Cells[13].Value.ToString(),
SheetTotal = Convert.ToInt32(row.Cells[14].Value),
DesignSoftware = row.Cells[15].Value.ToString(),
HasPdf = row.Cells[16].Value.ToString(),
PdfPath = row.Cells[17].Value.ToString(),
};
sheets.Insert(sheet);
this.Close();
}
}
}
This error are not from LiteDB (there is no DBNull in LiteDB). It's possible this DBNull are getting from row.Cells[n].Value when you try to convert.
LiteDB support nulls and nullable values (like int?).

How to remove the extra page at the end of a word document which created during mail merge

I have written a piece of code to create a word document by mail merge using Syncfusion (Assembly Syncfusion.DocIO.Portable, Version=17.1200.0.50,), Angular 7+ and .NET Core. Please see the code below.
private MemoryStream MergePaymentPlanInstalmentsScheduleToPdf(List<PaymentPlanInstalmentReportModel>
PaymentPlanDetails, byte[] templateFileBytes)
{
if (templateFileBytes == null || templateFileBytes.Length == 0)
{
return null;
}
var templateStream = new MemoryStream(templateFileBytes);
var pdfStream = new MemoryStream();
WordDocument mergeDocument = null;
using (mergeDocument = new WordDocument(templateStream, FormatType.Docx))
{
if (mergeDocument != null)
{
var mergeList = new List<PaymentPlanInstalmentScheduleMailMergeModel>();
var obj = new PaymentPlanInstalmentScheduleMailMergeModel();
obj.Applicants = 0;
if (PaymentPlanDetails != null && PaymentPlanDetails.Any()) {
var applicantCount = PaymentPlanDetails.GroupBy(a => a.StudentID)
.Select(s => new
{
StudentID = s.Key,
Count = s.Select(a => a.StudentID).Distinct().Count()
});
obj.Applicants = applicantCount?.Count() > 0 ? applicantCount.Count() : 0;
}
mergeList.Add(obj);
var reportDataSource = new MailMergeDataTable("Report", mergeList);
var tableDataSource = new MailMergeDataTable("PaymentPlanDetails", PaymentPlanDetails);
List<DictionaryEntry> commands = new List<DictionaryEntry>();
commands.Add(new DictionaryEntry("Report", ""));
commands.Add(new DictionaryEntry("PaymentPlanDetails", ""));
MailMergeDataSet ds = new MailMergeDataSet();
ds.Add(reportDataSource);
ds.Add(tableDataSource);
mergeDocument.MailMerge.ExecuteNestedGroup(ds, commands);
mergeDocument.UpdateDocumentFields();
using (var converter = new DocIORenderer())
{
using (var pdfDocument = converter.ConvertToPDF(mergeDocument))
{
pdfDocument.Save(pdfStream);
pdfDocument.Close();
}
}
mergeDocument.Close();
}
}
return pdfStream;
}
Once the document is generated, I notice there is a blank page (with the footer) at the end. I searched for a solution on the internet over and over again, but I was not able to find a solution. According to experts, I have done the initial checks such as making sure that the initial word template file has no page breaks, etc.
I am wondering if there is something that I can do from my code to remove any extra page breaks or anything like that, which can cause this.
Any other suggested solution for this, even including MS Word document modifications also appreciated.
Please refer the below documentation link to remove empty page at the end of Word document using Syncfusion Word library (Essential DocIO).
https://www.syncfusion.com/kb/10724/how-to-remove-empty-page-at-end-of-word-document
Please reuse the code snippet before converting Word to PDF in your sample application.
Note: I work for Syncfusion.

Custom properties are not updated for the word via openXML

I am trying to update custom properties of word document thru Open XML programming but it seems the updated properties are not getting saved properly for the word document. So when I opening document after successful execution of the update custom property code, I am getting the message box which is "This document contains field that may refer to other files; Do you want to update the fields in the Document?" If I am pressing 'NO' button then all the update properties would not be saved to the document. If we are going for yes option then it will update properties but I need to save the properties explicitly. Please suggest to save properties to the document without getting confirmation message or corrupting the document. :)
the code snippet is given as below,
public void SetCustomValue(
WordprocessingDocument document, string propname, string aValue)
{
CustomFilePropertiesPart oDocCustomProps = document.CustomFilePropertiesPart;
Properties props = oDocCustomProps.Properties;
if (props != null)
{
//logger.Debug("props is not null");
foreach (var prop in props.Elements<CustomDocumentProperty>())
{
if (prop != null && prop.Name == propname)
{
//logger.Debug("Setting Property: " + prop.Name + " to value: " + aValue);
prop.Remove();
var newProp = new CustomDocumentProperty();
newProp.FormatId = "{D5CDD505-2E9C-101B-9397-08002B2CF9AE}";
newProp.Name = prop.Name;
VTLPWSTR vTLPWSTR1 = new VTLPWSTR();
vTLPWSTR1.Text = aValue;
newProp.Append(vTLPWSTR1);
props.AppendChild(newProp);
props.Save();
}
}
int pid = 2;
foreach (CustomDocumentProperty item in props)
{
item.PropertyId = pid++;
}
props.Save();
}
}
I am using .Net framework 3.5 with Open XML SDK 2.0 and Office 2013.
Try this one
var CustomeProperties = xmlDOc.CustomFilePropertiesPart.Properties;
foreach (CustomDocumentProperty customeProperty in CustomeProperties)
{
if (customeProperty.Name == "DocumentName")
{
customeProperty.VTLPWSTR = new VTLPWSTR("My Custom Name");
}
else if (customeProperty.Name == "DocumentID")
{
customeProperty.VTLPWSTR = new VTLPWSTR("FNP.SMS.IQC");
}
else if (customeProperty.Name == "DocumentLastUpdate")
{
customeProperty.VTLPWSTR = new VTLPWSTR(DateTime.Now.ToShortDateString());
}
}
//Open Word Setting File
DocumentSettingsPart settingsPart = xmlDOc.MainDocumentPart.GetPartsOfType<DocumentSettingsPart>().First();
//Update Fields
UpdateFieldsOnOpen updateFields = new UpdateFieldsOnOpen();
updateFields.Val = new OnOffValue(true);
settingsPart.Settings.PrependChild<UpdateFieldsOnOpen>(updateFields);
settingsPart.Settings.Save();
you have to update your document fields on open.

Showing xtrareport report with subreports with scripts and charts in diff detailreports corrupts charts

I have a report that shows a collection of tests. The test report is actually another xtrareport that is shown as a subreport in the collection report. In these testreports there can be multiple subtests and. For each subtest there is a chart that is created in a script.
This is the script to create a graph for the subtest:
private void xrChart1_BeforePrint(object sender, System.Drawing.Printing.PrintEventArgs e)
{
XRChart chrt = (XRChart)sender;
XYDiagram axis = (XYDiagram)chrt.Diagram;
if (chrt.Series.Count > 0)
{
while (chrt.Series[0].View is ScatterLineSeriesView)
{
chrt.Series.RemoveAt(0);
}
}
Series standardSeries = chrt.Series[0];
Series allBottleSeries = chrt.Series[1];
var curColVal = this.DetailReport1.GetCurrentColumnValue("ShowCurve");
if (curColVal == null)
{
return;
}
chrt.BeginInit();
chrt.Visible = (bool)curColVal;
if (chrt.Visible)
{
List<TSegment> segments = (List<TSegment>)this.DetailReport1.GetCurrentColumnValue("Segments");
if (segments != null)
{
foreach (TSegment segment in segments)
{
Series tempSeries = new Series();
ScatterLineSeriesView tempscatterLineSeriesView = new ScatterLineSeriesView();
tempscatterLineSeriesView.LineMarkerOptions.BorderVisible = false;
tempscatterLineSeriesView.MarkerVisibility = DefaultBoolean.False;
tempscatterLineSeriesView.LineStyle.Thickness = segment.Thickness;
tempscatterLineSeriesView.Color = segment.SegmentColor;
tempSeries.LabelsVisibility = DefaultBoolean.False;
tempSeries.View = tempscatterLineSeriesView;
tempSeries.ShowInLegend = false;
tempSeries.ArgumentDataMember = "X";
tempSeries.ArgumentScaleType = ScaleType.Numerical;
tempSeries.ValueDataMembersSerializable = "Y";
tempSeries.DataSource = segment.Points;
chrt.Series.Insert(0, tempSeries);
}
}
standardSeries.ValueDataMembers[0] = "ODValue";
standardSeries.ArgumentDataMember = "ConcentrationValue";
standardSeries.DataSource = this.DetailReport1.GetCurrentColumnValue("Standards");
allBottleSeries.ValueDataMembers[0] = "Y";
allBottleSeries.ArgumentDataMember = "X";
allBottleSeries.DataSource = this.DetailReport1.GetCurrentColumnValue("BottlePoints");
axis.AxisX.Logarithmic = (bool)this.DetailReport1.GetCurrentColumnValue("XPlotIsLog");
axis.AxisX.LogarithmicBase = (double)this.DetailReport1.GetCurrentColumnValue("LogarithmicBase");
axis.AxisX.Title.Text = (string)this.DetailReport1.GetCurrentColumnValue("UnitsOfConcentration");
axis.AxisX.Label.NumericOptions.Format = NumericFormat.Number;
axis.AxisX.Label.NumericOptions.Precision = (int)this.DetailReport1.GetCurrentColumnValue("NumberOfDigitsInResults");
axis.AxisY.Label.NumericOptions.Format = NumericFormat.Number;
axis.AxisY.Label.NumericOptions.Precision = (int)this.DetailReport1.GetCurrentColumnValue("NumberOfDigitsInMeasuredValues");
axis.AxisY.Logarithmic = (bool)this.DetailReport1.GetCurrentColumnValue("YPlotIsLog");
axis.AxisY.LogarithmicBase = axis.AxisX.LogarithmicBase;
axis.AxisY.Title.Text = (string)this.DetailReport1.GetCurrentColumnValue("UnitsOfStandardsInput");
axis.AxisY.WholeRange.AlwaysShowZeroLevel = !(bool)this.DetailReport1.GetCurrentColumnValue("ODAxisShouldNotStartAtZero");
}
chrt.EndInit();
}
Now if I look at this subreport separately the report is shown correctly. The different subtests have a different chart.
The problem is when I show the collection report the the subreport is shown wrongly. All the charts are not different. The chart of the last subtest is shown all the time instead.
This script is used to set the reportsource of the subreports:
private void Detail1_BeforePrint(object sender, System.Drawing.Printing.PrintEventArgs e)
{
((XRSubreport)sender).ReportSource = this.DetailReport.GetCurrentRow() as XtraReport;
}
Anyone any ideas of what is going on here?
Found an answer to this issue.
It actually had nothing to do with the scripts.
The object we binded the collection report to has a property called TestXtrareports which is a List of XtraReport.
When we create this object we've called CreateDocument on the XtraReport before we've added it to TestXtraReports.
This is what caused this bug. Just deleting the createDocument statement of the XtraReports in TestXtraReports solved it.
CreateDocument is still called on the collection report.

Open XML word content controls

Here is my code trying to get the content controls with the tag "company"
using (WordprocessingDocument template = WordprocessingDocument.Open("d:/dev/ProposalTemplate1.dotx", true))
{
MainDocumentPart mainPart = template.MainDocumentPart;
SdtBlock block = mainPart.Document.Body.Descendants<SdtBlock>().Where(r => r.SdtProperties.GetFirstChild<Tag>().Val == "TEST").Single();
Text t = block.Descendants<Text>().Single();
t.Text = "COMPANY_NAME";
}
I got the error "Object reference not set to an instance of an object" because of the query line but I don't know why...
This works well when I create a simple template with just one content controls but not when using a bigger word template
Any idea ?
EDIT
I try doing it without .Single() but still not working
MainDocumentPart mainPart = template.MainDocumentPart;
var blocks = mainPart.Document.Body.Descendants<SdtBlock>().Where(r => r.SdtProperties.GetFirstChild<Tag>().Val == "Company");
foreach (SdtBlock block in blocks)
{
Text t = block.Descendants<Text>().Single();
t.Text = "COMPANY1";
}
EDIT 2
I change the Text.Single()
The problem is still there "Object reference not set to an instance of an object" on the SdtBlock block = ... line
MainDocumentPart mainPart = template.MainDocumentPart;
var blocks = mainPart.Document.Body.Descendants<SdtBlock>().Where(r => r.SdtProperties.GetFirstChild<Tag>().Val == "Company");
foreach (SdtBlock block in blocks)
{
var t = block.Descendants<Text>();
foreach (Text text in t)
{
text.Text = "COMPANY1";
}
}
Not all SdtBlock elements have child Tag elements. You are assuming one exists and attempting to access the Val property but are getting a null reference exception in doing so.
You can fix it by checking for null within the Where predicate:
var blocks = mainPart.Document.Body.Descendants<SdtBlock>().Where(r =>
{
var tag = r.SdtProperties.GetFirstChild<Tag>();
return tag != null && tag.Val == "Company";
});
As per the comments there is more information about the issues you originally had with using Single in my answer here.
Try this:
foreach( SdtBlock sdt in sdtList )
{
if( sdt.SdtProperties != null )
{
Tag tag = sdt.SdtProperties.GetFirstChild<Tag>();
if( tag!= null )
{
if( tag.Val.Value == "Company" )
{
if( sdt.InnerText != string.Empty )
{
//Do something
}
}
}
}
}
Accepted solution returns no results on my query either. So i come up with this solution;
var doc = document.MainDocumentPart.Document;
List<Tag> sdtSubTable = doc.Body.Descendants<Tag>().Where(r =>
{
return r != null && r.Val.Value.Contains("Company");
}).ToList();