none
c# image processing

All replies

  • now im doing image processing project.. i got the problem with the coding.. i have 10 excel files.. lets say, each file, i need to select only column A then transfer to new excel.. same goes to column B, C, D and etc.. so, could you help me with c# coding and include the head of coding because im not good in c#.. thank you..
    Sunday, December 08, 2013 2:12 PM
  • Hello zamrictro,

    >> now im doing image processing project

    >>  because im not good in c#..

    I am a bit confused with these statements. How are you doing the image processing project then? :)

    Anyway, in case of the image processing project I would recommend using Open XML SDK without involving the Excel Object Model and running Excel in the background. Thus, it will increase the overall speed of your application.

    Please read more about the mentioned above SDK in the Welcome to the Open XML SDK 2.5 for Office article in MSDN and http://openxmldeveloper.org/ web site.

    Sunday, December 08, 2013 2:31 PM
  • i got the data from my supervisor.. and i need to rearrange the data from the excels.. so, i need to use c# programming. ok.. tq..
    Sunday, December 08, 2013 2:41 PM
  • btw, when i write c# coding, the term of 'excel' is red line.. why this happen??
    Sunday, December 08, 2013 2:50 PM
  • zamrictro,

    Did you have a chance to look at the described above SDK and listed links?

    If you need to use the Excel Object Model, you may be interested in the Understanding the Excel Object Model from a .NET Developer's Perspective section in MSDN.
    Sunday, December 08, 2013 2:52 PM
  • Hello Zamrictro,

    The goal is here is slightly unclear. Do you want to convert your excel file to images? Can you please specify clearly the requirement.

    Thanks.


    Akshaya K Sharma

    Monday, December 09, 2013 3:40 AM
  • yes.. actually i do project of GPU.. so, the first thing i need to do is UWPI(ultrasonic wave propagation imaging).. i got the raw excel data (10 files) and i need to transpose the column and row.. then, each data transpose, i need to select column A and move to new excel.. same goes to column B, C, D until 500 column.. means, 10 raw excel will produce 500 new excel.. then, using 500 new excel, i need to process to image.. could you help me with the c# coding..??
    Monday, December 09, 2013 3:45 AM
  • Hi zamictro,

    As I said above, I would recommend using Open XML SDK without involving the Excel Object Model and running Excel in the background.

    Monday, December 09, 2013 8:23 AM
  • Hi zamictro,

    As you have been already advised above...Open XML SDK (please see it only supports documents created in Office 2007 and above) is the right way to do. I would do the following if I were you:

    1. Create a new C# Console application.

    2. Add the ClosedXML dll to it (this DLL makes lives easier in terms of excel operations). You can also use NuGet for this, it'll automatically add the OpenXML dependencies.

    3. See the transpose example here. In the "new XLWorkbook()" constructor, you should give the complete path of the excel file you want to work on and in the "ws.Range()" method give the range of the rows you want to transpose and rest is pretty much the same. If you are not sure about the value to give as parameters in "ws.Range()", then an alternative is using "ws.RangeUsed()" with no parameters, provided the sheet only contains the relevant data that you require i.e. if the excel sheet contains multiple sets of data of tables in the same sheet spread across different cell ranges, then you'll have no other option then to ws.Range() method with target range addresses.

    4. Once you are done transposing, retrieve the data from the excel file in datatable object as shown in the 2nd post here.

    5. Repeat step 3 for all the excel files and keep on adding the result to the datatable object until the column count has reached 500 (or whatever you target is).

    6. Once done, create a new excel file and insert the datatable object as shown here.

    Thats it! I guess even if you dont have enough C# experience but just following the example I cited and you can easily get this done. If you have any questions do let me know.

    P.S. I'll be grateful if you can mark my post as a reply if it solves your issue.


    Akshaya K Sharma

    Tuesday, December 10, 2013 4:49 AM
  • Hi,

    >>i need to select column A and move to new excel.. same goes to column B, C, D until 500 column.. means, 10 raw excel will produce 500 new excel.. <<

    If you want to move the colum to new WorkBook, you can refer to code below:

    Sub CreateWorkBook()
    Dim sheet As Worksheet
    Dim aWorkbook As Workbook
    copyColumnCount = 5
    Set sheet = Application.ActiveSheet
    For i = 1 To copyColumnCount
        sheet.Columns(i).Copy
        Set aWorkbook = Application.Workbooks.Add()
        aWorkbook.ActiveSheet.Paste
        aWorkbook.Save
    Next i
    
    End Sub
    

    The code will generate 5 new Workbooks to default local file location, it usual is C:/Users/UserName/Documents. You can find the location at the File->Option->Save-> default local file location. You can change the copyColumnCount to the number you wanted to copy.

    >>using 500 new excel, i need to process to image<<

    What do you mean process to image?

    Best regards

    Fei


    We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
    Click HERE to participate the survey.

    Tuesday, December 10, 2013 1:18 PM
    Moderator
  • I'm confused about what you want to do.  Before you get to the C# part, you don't you focus on the Excel part.  Do you want to copy Column A from 10 Excel files in a folder?  Is that the business requirements?

    http://www.rondebruin.nl/win/s3/win008.htm

    http://www.rondebruin.nl/win/s3/win011.htm


    Knowledge is the only thing that I can give you, and still retain, and we are both better off for it.

    Saturday, December 14, 2013 3:47 PM