我试图在某种食物类别中显示食谱,但没有运气。我通过父组件内的一系列配方来循环它。
<div class="row">
<div class="col-xs-8" *ngIf="{{ recipe.category }} === mexican">
<h4 class="list-group-item-heading">{{ recipe.name }}</h4>
<p class="list-group-item-text">{{ recipe.description }}</p>
</div>
<div class="col-xs-4">
<img src="{{ recipe.imagePath }}" alt="{{ recipe.name }}" class="img-responsive">
</div>
答案 0 :(得分:0)
虽然问题不明确,但我希望代码段可能有用。
using DocumentFormat.OpenXml;
using DocumentFormat.OpenXml.Packaging;
using DocumentFormat.OpenXml.Spreadsheet;
using Microsoft.IT.Sales.RelationshipManagement.Segmentation.DataContracts;
using Newtonsoft.Json.Linq;
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Threading.Tasks;
namespace ConsoleApp1
{
class Program
{
static void Main(string[] args)
{
PopulateExcel("E:\\Formula.xlsx");
Console.WriteLine("Hello World!");
}
private static void PopulateExcel(string Path)
{
WorkbookPart WP;
//WorksheetPart WSP;
String rId;
Worksheet WS;
SheetData StD;
Row R1;
Row R2;
Row R3;
Cell C1;
Cell C2;
Cell C3;
CellFormula CF;
CalculationChainPart CP;
CalculationChain CC;
CalculationCell CCell;
Workbook Workbook;
Sheet ss;
Sheet Sheet;
using (SpreadsheetDocument spreadSheet = SpreadsheetDocument.Open(Path, true))
{
// Get the SharedStringTablePart. If it does not exist, create a new one.
WP = spreadSheet.WorkbookPart;
var wsp = spreadSheet.WorkbookPart.WorksheetParts.FirstOrDefault(); //.ElementAt(sheetnumber);
SheetData sheetData = wsp.Worksheet.Descendants<SheetData>().LastOrDefault();
R1 = GetRow(sheetData, 2);
C1 = new Cell();
SetCell(C1, "A1", 1);
sheetData.Append(R1);
R1.Append(C1);
C2 = new Cell();
SetCell(C2, "B1", 2);
R1.Append(C2);
spreadSheet.WorkbookPart.Workbook.CalculationProperties.ForceFullCalculation = true;
spreadSheet.WorkbookPart.Workbook.CalculationProperties.FullCalculationOnLoad = true;
wsp.Worksheet.Save();
// Close the document.
spreadSheet.Close();
}
}
private static Row GetRow(SheetData wsData, UInt32 rowIndex)
{
var row = wsData.Elements<Row>().
Where(r => r.RowIndex.Value == rowIndex).FirstOrDefault();
if (row == null)
{
row = new Row();
row.RowIndex = rowIndex;
wsData.Append(row);
}
return row;
}
private static void SetCell(Cell cell, string Reference, int Value)
{
cell.CellReference = Reference;
cell.DataType = CellValues.Number;
cell.CellValue = new CellValue();
cell.CellValue.Text = Value.ToString();
}
}
}