Skip to content

Commit b8f6f10

Browse files
990212-FAQ
1 parent 52f28d1 commit b8f6f10

23 files changed

+47
-97
lines changed

Document-Processing/Excel/Excel-Library/NET/faqs/how-to-add-chart-labels-to-scatter-points.md

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -15,8 +15,7 @@ The following code illustrates adding chart labels to the scatter points of the
1515
using (ExcelEngine excelEngine = new ExcelEngine())
1616
{
1717
IApplication application = excelEngine.Excel;
18-
FileStream inputStream = new FileStream("Sample.xlsx", FileMode.Open, FileAccess.Read);
19-
IWorkbook workbook = application.Workbooks.Open(inputStream, ExcelOpenType.Automatic);
18+
IWorkbook workbook = application.Workbooks.Open("Sample.xlsx", ExcelOpenType.Automatic);
2019
IWorksheet worksheet = workbook.Worksheets[0];
2120

2221
//Get the chart from the charts collection
@@ -30,9 +29,8 @@ using (ExcelEngine excelEngine = new ExcelEngine())
3029

3130
//Set the Value to the Data Labels through Data Points
3231
serieOne.DataPoints[0].DataLabels.IsValue = true;
33-
34-
FileStream stream = new FileStream("ChartLabels.xlsx", FileMode.OpenOrCreate, FileAccess.ReadWrite);
35-
workbook.SaveAs(stream);
32+
33+
workbook.SaveAs("ChartLabels.xlsx");
3634
workbook.Close();
3735
excelEngine.Dispose();
3836
}

Document-Processing/Excel/Excel-Library/NET/faqs/how-to-change-the-grid-line-color-of-the-excel-sheet.md

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -21,9 +21,8 @@ using (ExcelEngine excelEngine = new ExcelEngine())
2121

2222
//To change the grid line color using ExcelKnownColors
2323
worksheet.GridLineColor = ExcelKnownColors.Blue;
24-
25-
FileStream stream = new FileStream("GridLineColor.xlsx", FileMode.OpenOrCreate, FileAccess.ReadWrite);
26-
workbook.SaveAs(stream);
24+
25+
workbook.SaveAs("GridLineColor.xlsx");
2726
workbook.Close();
2827
excelEngine.Dispose();
2928
}

Document-Processing/Excel/Excel-Library/NET/faqs/how-to-copy-a-range-from-one-workbook-to-another.md

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -18,10 +18,8 @@ using (ExcelEngine excelEngine = new ExcelEngine())
1818
{
1919
IApplication application = excelEngine.Excel;
2020
application.DefaultVersion = ExcelVersion.Excel2013;
21-
FileStream inputStream1 = new FileStream("SourceWorkbook.xlsx", FileMode.Open, FileAccess.Read);
22-
IWorkbook sourceWorkbook = application.Workbooks.Open(inputStream1, ExcelOpenType.Automatic);
23-
FileStream inputStream2 = new FileStream("DestinationWorkbook.xlsx", FileMode.Open, FileAccess.Read);
24-
IWorkbook destinationWorkbook = application.Workbooks.Open(inputStream2, ExcelOpenType.Automatic);
21+
IWorkbook sourceWorkbook = application.Workbooks.Open("SourceWorkbook.xlsx", ExcelOpenType.Automatic);
22+
IWorkbook destinationWorkbook = application.Workbooks.Open("DestinationWorkbook.xlsx", ExcelOpenType.Automatic);
2523

2624
//The first worksheet object in the worksheets collection in the Source Workbook is accessed.
2725
IWorksheet sourceWorksheet = sourceWorkbook.Worksheets[0];
@@ -36,8 +34,7 @@ using (ExcelEngine excelEngine = new ExcelEngine())
3634
//Copying (90 rows) from Source to Destination worksheet.
3735
sourceRange.CopyTo(destinationRange);
3836

39-
FileStream stream = new FileStream("CopyingRange.xlsx", FileMode.OpenOrCreate, FileAccess.ReadWrite);
40-
destinationWorkbook.SaveAs(stream);
37+
destinationWorkbook.SaveAs("CopyingRange.xlsx");
4138
destinationWorkbook.Close();
4239
excelEngine.Dispose();
4340
}

Document-Processing/Excel/Excel-Library/NET/faqs/how-to-copy-paste-the-cell-values-that-contain-only-formula.md

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -26,9 +26,8 @@ using (ExcelEngine excelEngine = new ExcelEngine())
2626

2727
//Copy and paste the values using ExcelCopyRangeOption
2828
sourceRange.CopyTo(destinationRange, ExcelCopyRangeOptions.None);
29-
30-
FileStream stream = new FileStream("Output.xlsx", FileMode.OpenOrCreate, FileAccess.ReadWrite);
31-
workbook.SaveAs(stream);
29+
30+
workbook.SaveAs("Output.xlsx");
3231
workbook.Close();
3332
excelEngine.Dispose();
3433
}

Document-Processing/Excel/Excel-Library/NET/faqs/how-to-create-a-chart-with-a-discontinuous-range.md

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -74,9 +74,8 @@ using (ExcelEngine excelEngine = new ExcelEngine())
7474
shape.TopRow = 10;
7575
shape.LeftColumn = 3;
7676
shape.RightColumn = 15;
77-
78-
FileStream stream = new FileStream("DiscontinuousRange.xlsx", FileMode.OpenOrCreate, FileAccess.ReadWrite);
79-
workbook.SaveAs(stream);
77+
78+
workbook.SaveAs("DiscontinuousRange.xlsx");
8079
workbook.Close();
8180
excelEngine.Dispose();
8281
}

Document-Processing/Excel/Excel-Library/NET/faqs/how-to-create-a-sparkline-from-a-named-range.md

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -46,9 +46,8 @@ using (ExcelEngine excelEngine = new ExcelEngine())
4646

4747
//Add a sparkline
4848
sparklines.Add(dataRange, referenceRange);
49-
50-
FileStream stream = new FileStream("SparklineFromNamedRange.xlsx", FileMode.OpenOrCreate, FileAccess.ReadWrite);
51-
workbook.SaveAs(stream);
49+
50+
workbook.SaveAs("SparklineFromNamedRange.xlsx");
5251
workbook.Close();
5352
excelEngine.Dispose();
5453
}

Document-Processing/Excel/Excel-Library/NET/faqs/how-to-define-discontinuous-ranges.md

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,8 +27,7 @@ using (ExcelEngine excelEngine = new ExcelEngine())
2727
rangeCollection.Add(worksheet.Range["D10:D11"]);
2828
rangeCollection.Text = "Welcome";
2929

30-
FileStream stream = new FileStream("DiscontinuousRange.xlsx", FileMode.OpenOrCreate, FileAccess.ReadWrite);
31-
workbook.SaveAs(stream);
30+
workbook.SaveAs("DiscontinuousRange.xlsx");
3231
workbook.Close();
3332
excelEngine.Dispose();
3433
}

Document-Processing/Excel/Excel-Library/NET/faqs/how-to-format-text-within-a-cell.md

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -37,9 +37,8 @@ using (ExcelEngine excelEngine = new ExcelEngine())
3737
blueFont.Italic = true;
3838
blueFont.RGBColor = Color.Blue;
3939
richText.SetFont(4, 7, blueFont);
40-
41-
FileStream stream = new FileStream("FormattingText.xlsx", FileMode.OpenOrCreate, FileAccess.ReadWrite);
42-
workbook.SaveAs(stream);
40+
41+
workbook.SaveAs("FormattingText.xlsx");
4342
workbook.Close();
4443
excelEngine.Dispose();
4544
}

Document-Processing/Excel/Excel-Library/NET/faqs/how-to-hide-the-summary-rows-and-columns-using-xlsio.md

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -15,8 +15,7 @@ You can hide the summary rows and columns by using the [IsSummaryRowBelow](https
1515
using (ExcelEngine excelEngine = new ExcelEngine())
1616
{
1717
IApplication application = excelEngine.Excel;
18-
FileStream inputStream = new FileStream("Sample.xlsx", FileMode.Open, FileAccess.Read);
19-
IWorkbook workbook = application.Workbooks.Open(inputStream, ExcelOpenType.Automatic);
18+
IWorkbook workbook = application.Workbooks.Open("Sample.xlsx", ExcelOpenType.Automatic);
2019
IWorksheet worksheet = workbook.Worksheets[0];
2120

2221
//Hide the summary rows at the bottom
@@ -25,8 +24,7 @@ using (ExcelEngine excelEngine = new ExcelEngine())
2524
//Hide the summary columns to the right
2625
worksheet.PageSetup.IsSummaryColumnRight = false;
2726

28-
FileStream stream = new FileStream("SuppressRowsColumns.xlsx", FileMode.OpenOrCreate, FileAccess.ReadWrite);
29-
workbook.SaveAs(stream);
27+
workbook.SaveAs("SuppressRowsColumns.xlsx");
3028
workbook.Close();
3129
excelEngine.Dispose();
3230
}

Document-Processing/Excel/Excel-Library/NET/faqs/how-to-ignore-the-green-error-marker-in-worksheets.md

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -15,15 +15,13 @@ When there exists data that are of different formats, the error marker appears i
1515
using (ExcelEngine excelEngine = new ExcelEngine())
1616
{
1717
IApplication application = excelEngine.Excel;
18-
FileStream inputStream = new FileStream("Sample.xlsx", FileMode.Open, FileAccess.Read);
19-
IWorkbook workbook = application.Workbooks.Open(inputStream, ExcelOpenType.Automatic);
18+
IWorkbook workbook = application.Workbooks.Open("Sample.xlsx", ExcelOpenType.Automatic);
2019
IWorksheet worksheet = workbook.Worksheets[0];
2120

2221
//Ignore Error Options
2322
worksheet.Range["B3"].IgnoreErrorOptions = ExcelIgnoreError.All;
2423

25-
FileStream stream = new FileStream("IgnoreGreenError.xlsx", FileMode.OpenOrCreate, FileAccess.ReadWrite);
26-
workbook.SaveAs(stream);
24+
workbook.SaveAs("IgnoreGreenError.xlsx");
2725
workbook.Close();
2826
excelEngine.Dispose();
2927
}

0 commit comments

Comments
 (0)