?
Solved

Problem to adjust sheet

Posted on 2016-07-31
1
Medium Priority
?
128 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 18

Accepted Solution

by:
xtermie earned 1000 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

Free learning courses: Active Directory Deep Dive

Get a firm grasp on your IT environment when you learn Active Directory best practices with Veeam! Watch all, or choose any amount, of this three-part webinar series to improve your skills. From the basics to virtualization and backup, we got you covered.

Question has a verified solution.

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

Windows Explorer let you handle zip folders nearly as any other folder: Copy, move, change, and delete, etc. In VBA you can also handle normal files and folders, but zip folders takes a little more - and that you'll find here.
Windows Explorer lets you open cabinet (cab) files like any other folder. In VBA you can easily handle normal files and folders, but opening and indeed creating cabinet files takes a lot more - and that's you'll find here.
This Micro Tutorial demonstrates in Microsoft Excel how to consolidate your marketing data by creating an interactive charts using form controls. This creates cool drop-downs for viewers of your chart to choose from.
Progress

862 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