Solved

Problem to adjust sheet

Posted on 2016-07-31
1
85 Views
Last Modified: 2016-08-22
Hi,
How to adjust these
    Using (SpreadsheetDocument spreadSheet = SpreadsheetDocument.Open(docName, true))
    {
        SharedStringTablePart shareStringPart;
        if (spreadSheet.WorkbookPart.GetPartsOfType<SharedStringTablePart>().Count() > 0)
        {
            shareStringPart = spreadSheet.WorkbookPart.GetPartsOfType<SharedStringTablePart>().First();
        }
        else
        {
            shareStringPart = spreadSheet.WorkbookPart.AddNewPart<SharedStringTablePart>();
        }

        int index = InsertSharedStringItem(text, shareStringPart);

        WorksheetPart worksheetPart = InsertWorksheet(spreadSheet.WorkbookPart);

        Cell cell = InsertCellInWorksheet("A", 1, worksheetPart);

        cell.CellValue = new CellValue(index.ToString());
        cell.DataType = new EnumValue<CellValues>(CellValues.SharedString);

        worksheetPart.Worksheet.Save();
    }

Open in new window

to put specific value into one cell of a selected sheet with a provided name?
0
Comment
Question by:HuaMinChen
1 Comment
 
LVL 17

Accepted Solution

by:
xtermie earned 500 total points
ID: 41765132
From what I understand you will need to
Set docName = "c:\test.xls"     'specify YOUR DOCUMENT here

Now for the value you have to be more specific
i.e. which cell, are there any conditions, what value etc
0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This is about my first experience with programming Arduino.
Freeze panes is an option within all variants of Excel to enable parts of a sheet to remain stationary when the cursor is in another part of the sheet. This is a very useful feature which is overlooked or under used.
This Micro Tutorial demonstrates how to create Excel charts: column, area, line, bar, and scatter charts. Formatting tips are provided as well.
In this fifth video of the Xpdf series, we discuss and demonstrate the PDFdetach utility, which is able to list and, more importantly, extract attachments that are embedded in PDF files. It does this via a command line interface, making it suitable …

929 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

12 Experts available now in Live!

Get 1:1 Help Now