Solved

Problem to adjust sheet

Posted on 2016-07-31
1
81 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

Do You Know the 4 Main Threat Actor Types?

Do you know the main threat actor types? Most attackers fall into one of four categories, each with their own favored tactics, techniques, and procedures.

Join & Write a Comment

A short article about problems I had with the new location API and permissions in Marshmallow
This is about my first experience with programming Arduino.
Graphs within dashboards are meant to be dynamic, representing data from a period of time that will change each time the dashboard is updated with new data. Rather than update each graph to point to a different set within a static set of data, t…
This Micro Tutorial will demonstrate how to use a scrolling table in Microsoft Excel using the INDEX function.

758 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

11 Experts available now in Live!

Get 1:1 Help Now