Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
P

Pankaj Saha

@Pankaj Saha
About
Posts
56
Topics
30
Shares
0
Groups
0
Followers
0
Following
0

Posts

Recent Best Controversial

  • Convert word file to pdf with openxml
    P Pankaj Saha

    Hi, I have an asp.net web application, I have read/write a word file with the help of openxml sdk. Now I need to convert that word file to a pdf format. Is there anyway to convert word file to pdf with the openxml sdk ?

    Pankaj

    C# csharp asp-net help question

  • export excel to pdf formate in c#
    P Pankaj Saha

    Pankaj Saha wrote:

    1. Whenever I do export, its open excel file. I do not want to open the excel file.

    I got the solution for this. Actually I did not see that little important thing. :omg:

    myExcelApp.Visible = false;

    now excel file is not opening. Now need the solution for the second problem. :confused:

    Pankaj

    ASP.NET csharp asp-net com sysadmin

  • export excel to pdf formate in c#
    P Pankaj Saha

    Hi, I have an asp.net web application. I have an excel sheet and I have to export that excel sheet to a pdf file. I have done it, but still facing some problems. 1. Whenever I do export, its open excel file. I do not want to open the excel file. 2. I have to convert the pdf file to landscape. Here is the code

    private void ExportExcelToPDF()
    {

            string sourceFilePath = Server.MapPath("~/aaa.xlsx");
            string destinationFilePath = Server.MapPath("~/aaa.pdf");
    
            Microsoft.Office.Interop.Excel.Application myExcelApp;
    
            Microsoft.Office.Interop.Excel.Workbooks myExcelWorkbooks = null;
    
            Microsoft.Office.Interop.Excel.Workbook myExcelWorkbook = null;
    
            try
            {
    
                object misValue = System.Reflection.Missing.Value;
    
                myExcelApp = new Microsoft.Office.Interop.Excel.ApplicationClass();
    
                myExcelApp.Visible = true;
                object varMissing = Type.Missing;
    
                myExcelWorkbooks = myExcelApp.Workbooks;
    
    
                //if file already exist then delete the file
                if (System.IO.File.Exists(destinationFilePath))
                {
                    System.IO.File.Delete(destinationFilePath);
                }
    
                myExcelWorkbook = myExcelWorkbooks.Open(sourceFilePath, misValue, misValue, misValue, misValue, misValue, misValue, misValue, misValue, misValue, misValue, misValue, misValue, misValue, misValue);
    
                myExcelWorkbook.ExportAsFixedFormat(Microsoft.Office.Interop.Excel.XlFixedFormatType.xlTypePDF,
                    destinationFilePath, Microsoft.Office.Interop.Excel.XlFixedFormatQuality.xlQualityStandard,
                    varMissing, false, varMissing, varMissing, false, varMissing);
    
                myExcelWorkbooks.Close();
    
                myExcelApp.Quit();
    
            }
            catch
            {
    
            }
            finally
            {
                myExcelApp = null;
            }
    
    
        }
    

    Pankaj

    ASP.NET csharp asp-net com sysadmin

  • fetch distinct record from the custom data type in ado.net entity framework
    P Pankaj Saha

    Hi, I have created a class customer and where I am fetching all the records from the customer table through the procedure. Now I want to fetch all the distinct city from the customer table. Here is the code p

    ublic List<City> GetAllDistinctCity()
    {
    //passing the connection string to the mode
    EntityDataMode entity = new EntityDataMode (Connection.ConnectionString);
    try
    {

                //List<Customer> = entity.GetAllCustomer().List();
    
                //fetching all the customers 
                var collection = entity.GetAllCustomer();
    
                //fetch all the distinct city from the customer
    
            }
            catch (Exception ex)
            {
                //
            }
    
            
        }
    

    If I create the view for the city, then I can directory fetch all the distinct city through the procedure, but I do not want to create any separate view for only city, which is a field of a customer table, because later I need to fetch another distinct field, then I have to again create a view for that field. Is there any simple method by which I can fetch distinct city using the GetAllCustomer() procedure

    Pankaj

    C# csharp sales

  • no ajax call after the session remove
    P Pankaj Saha

    hi, I have two MVC applications. I go to the MVC2 application from MVC1 application, I pass a token. When the MVC2 applications is loaded, its fetch the token and create the session. There are two button Logout and Save. I open MVC2 application in a IE browser and open the same application on the another tab. I just click the Logout button, which deletes all the sessions of the MVC2 application. Then I go to the first tab and click on the save button. Before saving the data, I simply check whether the session is exist or not, If session is exist then it will save the data otherwise redirect to the MVC1 application. But when I click on the Save button its shows the error "This page is accessing information that is not under its control. This proses a security risk. Do you want to continue?" I have used following code to check the session in the save button

    btnSave.bind("click", function(event) {

        isSessionActive();
    
        SaveData()
    

    }

    function isSessionActive() {
    $.ajax({
    url: "http://localhost/Home/IsSessionActive",
    type: "POST",
    data: {},
    success: function(result) {
    if (result !== "True") {

                window.location = "http://MVC1/Home";
    
            }
        }
    });
    

    }

    The server side code of IsSessionActive is public bool IsSessionActive() { if (Session == null || Session["AuthorizedToken"] == null) { return false; } return true; } I have also put the debugger point in the IsSessionActive function, but after logout it does not debug. It show the same message. Does anyone have any idea, how to resolve this problem. :confused:

    Pankaj

    ASP.NET debugging help asp-net sysadmin security

  • Logout from MVC
    P Pankaj Saha

    Thanks for you replay. Back button is not my problem. The problem is sessions are not expiring. When I go back to previous page and refresh the browser, I get all the information from the database again, this should not happen. Because before every database request its checks whether session is exist or not. If session is not exists then no database call will be fired. But this is not happening after the logout.

    Pankaj

    ASP.NET asp-net architecture help

  • Logout from MVC
    P Pankaj Saha

    Hi, I have a MVC application and I have to logout. To logout from the application I have created a link on te master page

    [ <a id="A2" name="lnkLogout" href="http://localhost:1234/Home/LogOut" >Logout</a> ]

    and created the LoutOut action in the controller page

    public ActionResult LogOut()
    {
    Session.Clear();
    Session.Abandon();
    Redirect("http://AnotherApplicaton/Home/LogOut");
    }

    Now when I click on the LogOut link its redirect to the LogOut action and in the LogOut action its delete all the session, but when I click on the back button of the browser its get back to the previous page and sessions are still alive. Does anyone have the solution of this problem.

    Pankaj

    ASP.NET asp-net architecture help

  • download doc or open pdf file in brower
    P Pankaj Saha

    Does anyone have the solution :confused:

    Pankaj

    ASP.NET javascript

  • New window should open in another browser
    P Pankaj Saha

    use the following code to open a new window

    window.open('pagename.aspx', '_blank');

    If you want to open a window with specific size then use window.open('Pagename.aspx', 'Help', config = 'height=800,width=1013,left=' + left + ', toolbar=no, menubar=no, scrollbars=yes, resizable=no,location=no, directories=no, status=no'); :)

    Pankaj

    ASP.NET collaboration help tutorial question

  • download doc or open pdf file in brower
    P Pankaj Saha

    Hi, I have to download a doc file and show the pdf file in the browser. For that I have used the following code in JavaScript of the button click

    window.open(url, 'Download', 'height=1,width=1,top=0,left=-1000');

    where url represent the path of the file (http://localhost/website/filename.doc).I do not want to show the popup window, for that I have used left=-1000, but it does not effect. Do you have any idea how I can hide that popup window :confused:

    Pankaj

    ASP.NET javascript

  • How to change debugger enviorment
    P Pankaj Saha

    Hi, I have already visual studio 2008 in my machine and then I installed vb6. Now the problem is when I use javascript debugging through the debugger keyword, its open the VB6 environment instead of Visual Studio. How to resolve this problem :confused:

    Pankaj

    .NET (Core and Framework) csharp javascript visual-studio debugging

  • vb calculation is diffrent than C# calculation [modified]
    P Pankaj Saha

    Thanks for your replay. But this is not the problem. How do I know how much digit I have to round up. There are more than 100 double variables and more than 100 complex calculation, then its very difficult to round each and every variable or calculated value, however in vb they did not use any round method.

    Pankaj

    ASP.NET csharp asp-net regex help

  • vb calculation is diffrent than C# calculation [modified]
    P Pankaj Saha

    Hi, I have a vb application, which contains lots of calculation and I am converting that application to asp.net C#. There are so many variables of double types in the vb application and I also took double in the c# for those variables. Now problem is that I do calculation with the same equation in both the application, however result value does not match. I have a variable var1 in vb the calculate double value is 1.63870925710649 (for vb) and 1.6387092571064941 (for c#), I do not understand why these values are different for the same datatype. And I have to use this variable in my equation, since both language has different value, this may be the reason of different final output. Some times I have to break the same equation into two or more equations for the C# , to get the same result in C# and sometimes I get the same result. But sometimes I get the value in c# which does not match the value of vb. I do not understand which calculation is right vb or C#.

    Pankaj

    modified on Tuesday, December 8, 2009 2:16 AM

    ASP.NET csharp asp-net regex help

  • Convert decimal value to exponential value
    P Pankaj Saha

    Got one solution

    string.Format("{0:#.0#E-00}", 1000000);

    Pankaj

    C# csharp

  • Convert decimal value to exponential value
    P Pankaj Saha

    I have done some small changed in the expression and got the near of correct result

    string.Format("{0:0.0E2}", 0.000597);

    then its returns 5.97E-004. Can we remove 00 after the E ?

    Pankaj

    C# csharp

  • Convert decimal value to exponential value
    P Pankaj Saha

    Thanks for your replay. When I run**

    string.Format("{0:0.0E+00}", 0.000597);

    **its return 6E-04 but I need 5.97E-4. I do not want to round the number.

    Pankaj

    C# csharp

  • Convert decimal value to exponential value
    P Pankaj Saha

    Hi, I have a decimal number. I need to convert this decimal value to exponential value. I have a vb.net code to convert from decimal to exponential value is Format(100000, #.0#E-##) . When I run this code in vb.net it returns 1.0E5 I need the same expression for the c#. I am using the following code String.Format("{0:E}", 100000) and its returns 1.000000E+005, but I need 1.0E5. The same for the another value String.Format("{0:E}", 0.000597), I need 5.97E-4 but it is returning 5.970000E-004. Does anyone let me know the right expression :confused:

    Pankaj

    C# csharp

  • Ungroup shape in word file in c#
    P Pankaj Saha

    May be you are right. I have also posted the code for ungrouping. But there are no problem in ungrouping. Do you have any solution without using threading ? ;)

    Pankaj

    C# csharp com help question

  • Ungroup shape in word file in c#
    P Pankaj Saha

    Got the solution I have used following code before ungrouping the shape System.Threading.Thread.Sleep(1000); Actually when c# code run its ungroup the shape first, then render the file, that's why shape is showing in the header of the page, not in the proper position. Now using the sleep method it renders the shape in proper place.

    Pankaj

    C# csharp com help question

  • Ungroup shape in word file in c#
    P Pankaj Saha

    Hi, I have a word file which contains numbers of shapes. Each shape contain some textboxes. I am copying that file to another location and assigning some values to those textboxes of those shapes. Now I have to assign the values to those textboxes then I have to ungroup those shape first then only I can assign values those text boxes. Now the problem is that when I ungroup those shapes, they change their locations in the document. I do not understand what is the problem. Here is the code //copy the sourc file to another location System.IO.File.Copy(Convert.ToString(source), Convert.ToString(destination)); Microsoft.Office.Interop.Word.Document obDoc = new Microsoft.Office.Interop.Word.Document(); object unknown = Type.Missing; object format = Microsoft.Office.Interop.Word.WdSaveFormat.wdFormatDocumentDefault; obDoc = varWord.Documents.Add(ref source, ref unknown, ref unknown, ref visible); obDoc.Activate(); //hiding a shape--working fine obj = "shape1"; varWord.ActiveDocument.Shapes.get_Item(ref obj).Select(ref unknown); varWord.ActiveDocument.Shapes.get_Item(ref obj).Visible = MsoTriState.msoFalse; //ungroup the shape obj = "Shape2"; varWord.ActiveDocument.Shapes.get_Item(ref obj).Select(ref unknown); varWord.ActiveDocument.Shapes.get_Item(ref obj).Ungroup(); obj = "txtbox1"; varWord.ActiveDocument.Shapes.get_Item(ref obj).Select(ref unknown); varWord.Selection.TypeText(txtbox1value); //show the word file varWord.Visible = true; varWord = null; :(

    Pankaj

    C# csharp com help question
  • Login

  • Don't have an account? Register

  • Login or register to search.
  • First post
    Last post
0
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups