How to extract formatted cells and their corresponding rows in Excel

时间:2017-08-30 20:07:45

标签: excel pandas xlsxwriter

SO, my problem is as follows:

Using this script written below, I have successfully formatted certain cells in the extracted excel sheet. It is intended to accept any excel file as long as it is entered correctly and is in the same format (which for my purposes will always be in the same format).

My next step (my problem): is how to I grab the cells that have been formatted and their corresponding rows, and then print those rows into a new file.

Using a very similar program I am able to take the chosen formatted excel file. But do not know what my course

#somelement {
  position: absolute;
  left: 50%;
  -webkit-transform: translateX(-50%);
  transform: translateX(-50%)
}

Using a very similar program I am able to take the chosen formatted excel file. But do not know what my course of action would be. Here is an example of what I have tried.

private Graphics takeScreenshot()
{
    //Create a new bitmap.
    var bmpScreenshot = new Bitmap(Screen.PrimaryScreen.Bounds.Width,
                                   Screen.PrimaryScreen.Bounds.Height,
                                   System.Drawing.Imaging.PixelFormat.Format32bppArgb);

    // Create a graphics object from the bitmap.
    var gfxScreenshot = Graphics.FromImage(bmpScreenshot);

    // Take the screenshot from the upper left corner to the right bottom corner.
    gfxScreenshot.CopyFromScreen(Screen.PrimaryScreen.Bounds.X,
                                Screen.PrimaryScreen.Bounds.Y,
                                0,
                                0,
                                Screen.PrimaryScreen.Bounds.Size,
                                CopyPixelOperation.SourceCopy);

    return gfxScreenshot;
}

But i keep getting an error.

Sorry for the edit post, I clicked advance before completed.

1 个答案:

答案 0 :(得分:0)

你写的循环不正确。那是因为df==format1等同于布尔True。如果您只想在某些条件成立时打印i,请执行以下操作:

upperBound = 1000
for i in range(upperBound):
    if df==format1:
        print(i)