TECHNOLOGIES
FORUMS
JOBS
BOOKS
EVENTS
INTERVIEWS
Live
MORE
LEARN
Training
CAREER
MEMBERS
VIDEOS
NEWS
BLOGS
Sign Up
Login
No unread comment.
View All Comments
No unread message.
View All Messages
No unread notification.
View All Notifications
Answers
Post
An Article
A Blog
A News
A Video
An EBook
An Interview Question
Ask Question
Forums
Monthly Leaders
Forum guidelines
Kalyani Shevale
NA
3.2k
701.3k
how to get 1st column value in spreadsheet Document in mvc
Nov 19 2018 1:20 AM
I have created an Open XML document file
in Existing Spreadsheet document open then read the 1st column value in this file.
SpreadsheetDocument spreadsheetDocument =
SpreadsheetDocument.Open(srcFile,
true
);
WorksheetPart newWorksheetPart = spreadsheetDocument.WorkbookPart.AddNewPart<WorksheetPart>();
newWorksheetPart.Worksheet =
new
Worksheet(
new
SheetData());
WorkbookPart workbookPart = spreadsheetDocument.WorkbookPart;
Sheets sheets = spreadsheetDocument.WorkbookPart.Workbook.GetFirstChild<Sheets>();
string
relationshipId = spreadsheetDocument.WorkbookPart.GetIdOfPart(newWorksheetPart);
uint
sheetId = 1;
SheetData sheetData = newWorksheetPart.Worksheet.GetFirstChild<SheetData>();
IEnumerable<WorksheetPart> worksheetPart = workbookPart.WorksheetParts;
int
rocount=0;
Sheet sheet = workbookPart.Workbook.Descendants<Sheet>()
.Where(s => s.Name ==
"Survey Details"
).FirstOrDefault();
foreach
(WorksheetPart WSP
in
worksheetPart)
{
//find sheet data
IEnumerable<SheetData> sheetData1 = WSP.Worksheet.Elements<SheetData>();
// Iterate through every sheet inside Excel sheet
foreach
(SheetData SD
in
sheetData1)
{
IEnumerable<Row> row = SD.Elements<Row>();
// Get the row IEnumerator
IEnumerable<Column> column = SD.Elements<Column>();
var d = column.Count();
rocount=(row.Count());
// Will give you the count of rows
}
}
how to read column value in c#
Reply
Answers (
12
)
how can i remove error icon in textbox is not empty
how to use progress bar for custom code..